Index: /branches/eam_branches/ipp-20130419/pswarp/src/pswarpCleanup.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pswarp/src/pswarpCleanup.c	(revision 35535)
+++ /branches/eam_branches/ipp-20130419/pswarp/src/pswarpCleanup.c	(revision 35536)
@@ -11,5 +11,25 @@
 
 # include "pswarp.h"
-# include "pswarpFileNames.h"
+
+// Lists of file rules which we may need to save here
+static char *outputFiles[] = {
+  "PSWARP.OUTPUT",
+  "PSWARP.OUTPUT.MASK",
+  "PSWARP.OUTPUT.VARIANCE",
+  "PSWARP.OUTPUT.BKGMODEL",
+  "PSWARP.OUTPUT.SOURCES",
+  "PSPHOT.INPUT",
+  "PSPHOT.OUTPUT",
+  "PSPHOT.RESID",
+  "PSPHOT.BACKMDL",
+  "PSPHOT.BACKMDL.STDEV",
+  "PSPHOT.BACKGND",
+  "PSPHOT.BACKSUB",
+  "PSPHOT.PSF.SAVE",
+  "SOURCE.PLOT.MOMENTS",
+  "SOURCE.PLOT.PSFMODEL",
+  "SOURCE.PLOT.APRESID",
+  NULL
+};
 
 void pswarpCleanup (pmConfig *config, pswarpStatsFile *statsFile)
@@ -17,11 +37,9 @@
     psExit exitValue = pswarpExitCode(PS_EXIT_SUCCESS); // Exit code
 
-    // Ensure everything is written out, at every level
-    pswarpFileActivation(config, detectorFiles, false);
-    pswarpFileActivation(config, independentFiles, false);
-
-    pswarpFileActivation(config, photFiles, true);
-    pswarpFileActivation(config, skycellFiles, true);
-    pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.SOURCES");
+    // activate all of the relevant output files
+    pmFPAfileActivate(config->files, false, NULL);
+    for (int i = 0; outputFiles[i] != NULL; i++) {
+        pmFPAfileActivate(config->files, true, outputFiles[i]);
+    }
 
     pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT");
Index: /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c	(revision 35535)
+++ /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c	(revision 35536)
@@ -11,5 +11,4 @@
 
 #include "pswarp.h"
-#include "pswarpFileNames.h"            // Lists of file rules used at different stages
 
 // Loop over the inputs, warp them to the output skycell and then update metadata
@@ -47,4 +46,14 @@
     }
 
+    // load in the input pixel data (ex. background model)
+    pmFPAfileActivate(config->files, false, NULL);
+    pmFPAfileActivate(config->files, true, "PSWARP.INPUT");
+    pmFPAfileActivate(config->files, true, "PSWARP.MASK");
+    pmFPAfileActivate(config->files, true, "PSWARP.VARIANCE");
+
+    // We re-activate the CMF load so we can transform the sources as well as the pixels.
+    // We only need to read in these if the astrometry source is CMF.
+    pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
+
     // loop over this section once per input group
     for (int i = 0; i < nInputs; i++) {
@@ -61,15 +70,4 @@
 	    astrom = input;
 	}
-
-	// ensure everyone is off except what we need below 
-	// XXX double-check activation issues in general
-	pswarpFileActivation(config, detectorFiles, true);
-	pswarpFileActivation(config, photFiles, false);
-	pswarpFileActivation(config, independentFiles, false);
-	pswarpFileActivation(config, skycellFiles, false);
-    
-	// We re-activate the CMF load so we can transform the sources as well as the pixels.
-	// We only need to read in these if the astrometry source is CMF.
-	pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
 
 	pmFPAviewReset (view);
@@ -146,8 +144,4 @@
 	}
 
-	// Done with the detector side of things
-	pswarpFileActivation(config, detectorFiles, false);
-	pswarpFileActivation(config, independentFiles, false);
-
 	if (!pswarpUpdateStatistics (output->fpa, stats, input->fpa, astrom->fpa, config)) {
 	    psError(psErrorCodeLast(), false, "problem generating statistics.");
Index: /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoopBackground.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoopBackground.c	(revision 35535)
+++ /branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoopBackground.c	(revision 35536)
@@ -11,5 +11,4 @@
 
 #include "pswarp.h"
-#include "pswarpFileNames.h"            // Lists of file rules used at different stages
 
 #define WCS_NONLIN_TOL 0.001            // Non-linear tolerance for header WCS
@@ -58,4 +57,8 @@
         return false;
     }
+
+    // we are only reading the background models, not writing anything
+    pmFPAfileActivate(config->files, false, NULL);
+    pmFPAfileActivate(config->files, true, "PSWARP.BKGMODEL");
 
     // loop over this section once per input group
@@ -83,13 +86,4 @@
 	    input->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
 	}
-
-	// we only need to load the background models here 
-	pswarpFileActivation(config, detectorFiles, false);
-	pswarpFileActivation(config, photFiles, false);
-	pswarpFileActivation(config, independentFiles, false);
-	pswarpFileActivation(config, skycellFiles, false);
-
-	// we are only reading the background models, not writing anything
-	pmFPAfileActivate(config->files, true, "PSWARP.BKGMODEL");
 
 	pmFPAviewReset (view);
