Index: trunk/magic/remove/src/streaksio.c
===================================================================
--- trunk/magic/remove/src/streaksio.c	(revision 23911)
+++ trunk/magic/remove/src/streaksio.c	(revision 23936)
@@ -968,5 +968,5 @@
 
 void
-setMaskedToNAN(streakFiles *sfiles, psU8 maskMask, bool printCounts)
+setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts)
 {
         int maskedPixels = 0;
@@ -991,5 +991,5 @@
                 // but I want to get the counts
                 double imageVal  = psImageGet(image, x, y);
-                psU8 maskVal;
+                psU32 maskVal;
                 if (sfiles->stage == IPP_STAGE_RAW) {
                     int xChip, yChip;
@@ -1044,2 +1044,36 @@
     }
 }
+
+void
+strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask)
+{
+    if (sfiles->inMask->header) {
+        if (!pmConfigMaskReadHeader(sfiles->config, sfiles->inMask->header)) {
+            streaksExit("failed to read mask values from file", PS_EXIT_CONFIG_ERROR);
+        }
+    }
+
+    bool status;
+    psMetadata *masks = psMetadataLookupMetadata(&status, sfiles->config->recipes, "MASKS");
+    if (!status) {
+        psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n");
+        streaksExit("", PS_EXIT_CONFIG_ERROR);
+    }
+    *maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
+    if (!status) {
+        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
+        streaksExit("", PS_EXIT_CONFIG_ERROR);
+    }
+
+    // optionally setting pixels with any mask bits execpt CONV.POOR to NAN
+    // check old name first
+    psU32 convPoor = (double) psMetadataLookupU32(&status, masks, "POOR.WARP");
+    if (!status) {
+        convPoor = (double) psMetadataLookupU32(&status, masks, "CONV.POOR");
+        if (!status) {
+            psError(PM_ERR_CONFIG, false, "failed to lookup mask value for CONV.POOR in recipes\n");
+            streaksExit("", PS_EXIT_CONFIG_ERROR);
+        }
+    }
+    *maskMask = ~convPoor;
+}
Index: trunk/magic/remove/src/streaksio.h
===================================================================
--- trunk/magic/remove/src/streaksio.h	(revision 23911)
+++ trunk/magic/remove/src/streaksio.h	(revision 23936)
@@ -16,4 +16,5 @@
 void copyFitsOptions(sFile *out, sFile *rec, sFile *in);
 void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll);
+void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask);
 
 void writeImage(sFile *sfile, psString extname, int extnum);
@@ -25,5 +26,5 @@
 
 bool isExciseValue(double, double);
-void setMaskedToNAN(streakFiles *sfiles, psU8 maskMask, bool printCounts);
+void setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts);
 
 bool replicateOutputs(streakFiles *sf);
Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 23911)
+++ trunk/magic/remove/src/streaksremove.c	(revision 23936)
@@ -23,22 +23,6 @@
     }
 
-    psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS");
-    if (!status) {
-        psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n");
-        streaksExit("", PS_EXIT_CONFIG_ERROR);
-    }
-    double maskStreak = (double) psMetadataLookupU16(&status, masks, "STREAK");
-    if (!status) {
-        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
-        streaksExit("", PS_EXIT_CONFIG_ERROR);
-    }
-
-    // optionally setting pixels with any mask bits execpt POOR.WARP to NAN
-    psU16 poorWarp = (double) psMetadataLookupU16(&status, masks, "CONV.POOR");
-    if (!status) {
-        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for POOR.WARP in recipes\n");
-        streaksExit("", PS_EXIT_CONFIG_ERROR);
-    }
-    psU16 maskMask = ~poorWarp;
+    psU32 maskStreak = 0;
+    psU32 maskMask = 0;
 
     psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
@@ -114,4 +98,9 @@
         }
 
+        // now that we've read the input files, lookup the mask values
+        if (maskStreak == 0) {
+            strkGetMaskValues(sfiles, &maskStreak, &maskMask);
+        }
+
         totalPixels += sfiles->inImage->numRows * sfiles->inImage->numCols;
 
@@ -131,4 +120,6 @@
                     psTimerStart("EXCISE_NON_WARPED");
 
+                    // set non-warped pixels and variance to NAN, mask to maskStreak (since the pixel
+                    // is excised as part of the destreaking process)
                     exciseNonWarpedPixels(sfiles, maskStreak);
 
@@ -648,4 +639,5 @@
             }
         }
+        // XXX: check this
         // Assumption: there are no mask and weight images for video cells
         return;
