Index: trunk/ppSim/src/ppSimUtils.c
===================================================================
--- trunk/ppSim/src/ppSimUtils.c	(revision 20365)
+++ trunk/ppSim/src/ppSimUtils.c	(revision 23836)
@@ -112,7 +112,7 @@
 ppSimType ppSimTypeFromString (char *typeStr) {
 
-    if (!strcasecmp (typeStr, "BIAS")) 	 return PPSIM_TYPE_BIAS;
-    if (!strcasecmp (typeStr, "DARK")) 	 return PPSIM_TYPE_DARK;
-    if (!strcasecmp (typeStr, "FLAT")) 	 return PPSIM_TYPE_FLAT;
+    if (!strcasecmp (typeStr, "BIAS"))   return PPSIM_TYPE_BIAS;
+    if (!strcasecmp (typeStr, "DARK"))   return PPSIM_TYPE_DARK;
+    if (!strcasecmp (typeStr, "FLAT"))   return PPSIM_TYPE_FLAT;
     if (!strcasecmp (typeStr, "OBJECT")) return PPSIM_TYPE_OBJECT;
     psAbort("Should never get here.");
@@ -174,5 +174,5 @@
     if (binning <= 0) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning);
-	exit(PS_EXIT_CONFIG_ERROR);
+        exit(PS_EXIT_CONFIG_ERROR);
     }
     return true;
@@ -181,8 +181,8 @@
 // Get a value from the command-line arguments and add it to recipe options
 float ppSimArgToRecipeF32(bool *status,
-			  psMetadata *options,    // Target to which to add value
-			  const char *recipeName, // Name for value in the recipe
-			  psMetadata *arguments,  // Command-line arguments
-			  const char *argName	    // Argument name in the command-line arguments
+                          psMetadata *options,    // Target to which to add value
+                          const char *recipeName, // Name for value in the recipe
+                          psMetadata *arguments,  // Command-line arguments
+                          const char *argName       // Argument name in the command-line arguments
     )
 {
@@ -198,8 +198,8 @@
 // Get a value from the command-line arguments and add it to recipe options
 int ppSimArgToRecipeS32(bool *status,
-			psMetadata *options,    // Target to which to add value
-			const char *recipeName, // Name for value in the recipe
-			psMetadata *arguments,  // Command-line arguments
-			const char *argName	    // Argument name in the command-line arguments
+                        psMetadata *options,    // Target to which to add value
+                        const char *recipeName, // Name for value in the recipe
+                        psMetadata *arguments,  // Command-line arguments
+                        const char *argName         // Argument name in the command-line arguments
     )
 {
@@ -214,8 +214,8 @@
 // Get a value from the command-line arguments and add it to recipe options
 bool ppSimArgToRecipeBool(bool *status,
-			  psMetadata *options,    // Target to which to add value
-			  const char *recipeName, // Name for value in the recipe
-			  psMetadata *arguments,  // Command-line arguments
-			  const char *argName	    // Argument name in the command-line arguments
+                          psMetadata *options,    // Target to which to add value
+                          const char *recipeName, // Name for value in the recipe
+                          psMetadata *arguments,  // Command-line arguments
+                          const char *argName       // Argument name in the command-line arguments
     )
 {
@@ -231,8 +231,8 @@
 // if it is not specified, do not override the existing recipe value
 char *ppSimArgToRecipeStr(bool *status,
-			  psMetadata *options,    // Target to which to add value
-			  const char *recipeName, // Name for value in the recipe
-			  psMetadata *arguments,  // Command-line arguments
-			  const char *argName	    // Argument name in the command-line arguments
+                          psMetadata *options,    // Target to which to add value
+                          const char *recipeName, // Name for value in the recipe
+                          psMetadata *arguments,  // Command-line arguments
+                          const char *argName       // Argument name in the command-line arguments
     )
 {
@@ -241,5 +241,5 @@
     char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest
     if (status) {
-	*status = myStatus;
+        *status = myStatus;
     }
     if (!value) return NULL;
@@ -248,32 +248,17 @@
 }
 
-float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {
-
-    bool mdok;
-    float zp;
+float ppSimGetZeroPoint(psMetadata *recipe, const char *filter)
+{
+    PS_ASSERT_METADATA_NON_NULL(recipe, NAN);
+    PS_ASSERT_STRING_NON_EMPTY(filter, NAN);
 
     // use the filter to get the zeropoint from the recipe
-    psMetadataItem *zpItem = psMetadataLookup (recipe, "ZEROPTS");
-    // check that item is multi...
-	    
-    psArray *entries = psListToArray (zpItem->data.list);
-	  
-    // search for matching filter
-    for (int i = 0; i < entries->n; i++) {
-	psMetadataItem *item = entries->data[i];
-	psMetadata *entry = item->data.V;
-
-	char *filterName = psMetadataLookupStr (&mdok, entry, "FILTER");
-	assert (filterName);
-
-	if (strcmp(filterName, filter)) continue;
-
-	zp = psMetadataLookupF32 (&mdok, entry, "ZERO_PT");
-	assert (mdok);
-	psFree (entries);
-	return zp;
-    }
-    psFree (entries);
-    return NAN;
+    psMetadata *zeropoints = psMetadataLookupMetadata(NULL, recipe, "ZEROPTS");
+    if (!zeropoints) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to find ZEROPTS in recipe");
+        return NAN;
+    }
+
+    return psMetadataLookupF32(NULL, zeropoints, filter);
 }
 
@@ -295,5 +280,5 @@
 
     for (int i = 0; i < sources->n; i++) {
-	pmSource *source = sources->data[i];
+        pmSource *source = sources->data[i];
 
         // allocate image, weight, mask arrays for each peak (square of radius OUTER)
