Index: trunk/ppStats/src/ppStats.c
===================================================================
--- trunk/ppStats/src/ppStats.c	(revision 13640)
+++ trunk/ppStats/src/ppStats.c	(revision 13658)
@@ -12,11 +12,25 @@
                     pmFPA *fpa,         // FPA for which to get statistics
                     pmFPAview *view,    // View for analysis
+                    psMaskType maskVal, // Value to mask
                     pmConfig *config    // Configuration
     )
 {
-    psExit status;
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL)
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(config, NULL);
+
+    ppStatsData *data = ppStatsDataAlloc(); // All the input data
 
     // Get the options, open the files
-    ppStatsData *data = ppStatsSetupFromRecipe(NULL, config);
+    if (!ppStatsSetupFromRecipe(data, config)) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to get ppStats options from recipe.");
+        psFree(data);
+        return NULL;
+    }
+
+    // Override recipe mask value if one is provided
+    if (maskVal != 0) {
+        data->maskVal = maskVal;
+    }
 
     if (data->fpa) {
@@ -31,10 +45,11 @@
 
     // Go through the FPA and do the hard work
+    psExit status;                      // Status of statistics loop
     psMetadata *result = ppStatsLoop(&status, out, data, config);
     if (status != PS_EXIT_SUCCESS) {
-	psError (PS_ERR_UNKNOWN, false, "trouble getting stats\n");
+        psError (PS_ERR_UNKNOWN, false, "Not able to measure FPA statistics.\n");
         psFree(result);
-	psFree(data);
-	return (NULL);
+        psFree(data);
+        return (NULL);
     }
 
