Index: /trunk/magic/censorObjects/src/Makefile.am
===================================================================
--- /trunk/magic/censorObjects/src/Makefile.am	(revision 24694)
+++ /trunk/magic/censorObjects/src/Makefile.am	(revision 24695)
@@ -31,4 +31,6 @@
 	censorLoop.c                \
 	censorReadout.c             \
+	censorErrorCodes.c          \
+	censorVersion.c             \
 	censorCleanup.c
 
Index: /trunk/magic/censorObjects/src/censor.c
===================================================================
--- /trunk/magic/censorObjects/src/censor.c	(revision 24694)
+++ /trunk/magic/censorObjects/src/censor.c	(revision 24695)
@@ -29,5 +29,5 @@
 
     // load configuration information
-    pmConfig *config = config = censorArguments(argc, argv);
+    pmConfig *config = censorArguments(argc, argv);
     if (!config) {
         usage();
Index: /trunk/magic/censorObjects/src/censor.h
===================================================================
--- /trunk/magic/censorObjects/src/censor.h	(revision 24694)
+++ /trunk/magic/censorObjects/src/censor.h	(revision 24695)
@@ -14,4 +14,11 @@
 # define CENSOR_H
 
+# include <stdio.h>
+# include <string.h>
+# include <strings.h>  // for strcasecmp
+# include <unistd.h>   // for unlink
+# include <pslib.h>
+# include <psmodules.h>
+# include <ppStats.h>
 # include "censorErrorCodes.h"
 
@@ -21,7 +28,9 @@
 # define CENSOR_RECIPE "CENSOR" ///< Name of the recipe to use
 
+pmConfig *censorArguments (int argc, char **argv);
 bool censorParseCamera (pmConfig *config);
 bool censorLoop (pmConfig *config);
 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view);
+void censorCleanup (pmConfig *config);
 
 // Return version strings.
Index: /trunk/magic/censorObjects/src/censorArguments.c
===================================================================
--- /trunk/magic/censorObjects/src/censorArguments.c	(revision 24694)
+++ /trunk/magic/censorObjects/src/censorArguments.c	(revision 24695)
@@ -11,5 +11,5 @@
  */
 
-# include "censorStandAlone.h"
+# include "censor.h"
 
 pmConfig *censorArguments (int argc, char **argv) {
@@ -31,8 +31,4 @@
         return NULL;
     }
-
-    // save the following additional recipe values based on command-line options
-    // these options override the CENSOR recipe values loaded from recipe files
-    psMetadata *options = pmConfigRecipeOptions (config, CENSOR_RECIPE);
 
     // define the input mask
Index: /trunk/magic/censorObjects/src/censorLoop.c
===================================================================
--- /trunk/magic/censorObjects/src/censorLoop.c	(revision 24694)
+++ /trunk/magic/censorObjects/src/censorLoop.c	(revision 24695)
@@ -63,5 +63,5 @@
 		if (!readout->data_exists) { continue; }
 
-		if (!censorReadout (readout, recipe)) ESCAPE;
+		if (!censorReadout (readout, config, view)) ESCAPE;
 
 		if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
Index: /trunk/magic/censorObjects/src/censorReadout.c
===================================================================
--- /trunk/magic/censorObjects/src/censorReadout.c	(revision 24694)
+++ /trunk/magic/censorObjects/src/censorReadout.c	(revision 24695)
@@ -1,5 +1,5 @@
 /** @file censorReadout.c
  *
- *  @brief reject detections that land within the magic mask regions
+ *  @brief reject detections that land within the streak mask regions
  *
  *  @ingroup censor
@@ -24,5 +24,5 @@
     }
 
-    psImageMaskType magicMaskValue = pmConfigMaskGet("MAGIC", config); // Mask value for magic pixels
+    psImageMaskType streakMaskValue = pmConfigMaskGet("STREAK", config); // Mask value for streak pixels
 
     psLogMsg ("censor", PS_LOG_INFO, "generating a bright-star mask");
@@ -37,12 +37,18 @@
     // XXX why not do this? 
     pmReadout *readoutMask = pmFPAviewThisReadout (view, inMask->fpa);
-    if (!readoutMask) continue;
+    if (!readoutMask) {
+        psError(CENSOR_ERR_CONFIG, true, "Can't find mask for this readout");
+	return false;
+    }
 
     // select the raw objects for this readout, flag is they fall in a mask
     psArray *inSources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
-    if (inSources == NULL) continue;
+    if (inSources == NULL) {
+        psError(CENSOR_ERR_CONFIG, true, "Can't find sources for this readout");
+	return false;
+    }
 		
     // create a replacement output array:
-    psArray *outSources = psAllocArrayEmpty(100);
+    psArray *outSources = psArrayAllocEmpty(100);
 
     // only keep sources that do not match the specified mask bit
@@ -61,6 +67,6 @@
 	if (onChip) {
 	    psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip];
-	    if (value & magicMaskValue) {
-		// skip sources on magic masks
+	    if (value & streakMaskValue) {
+		// skip sources on streak masks
 		continue;
 	    }
@@ -69,7 +75,10 @@
     }
 
+    psLogMsg ("censor", PS_LOG_INFO, "keeping %ld of %ld sources", outSources->n, inSources->n);
+
     // remove the inSources and replace with the outSources
-    psMetadataRemove (readout->analysis, "PSPHOT.SOURCES");
+    psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES");
     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "sources", outSources);
+    psFree (outSources);
 
     return true;
