Index: trunk/psphot/src/psphotStackArguments.c
===================================================================
--- trunk/psphot/src/psphotStackArguments.c	(revision 38383)
+++ trunk/psphot/src/psphotStackArguments.c	(revision 38384)
@@ -31,4 +31,11 @@
     // these options override the PSPHOT recipe values loaded from recipe files
     psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
+
+    bool updateMode = false;
+    if ((N = psArgumentGet (argc, argv, "-updatemode"))) {
+        psArgumentRemove (N, &argc, argv);
+        updateMode = true;
+    }
+    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSPHOT.STACK.UPDATEMODE", 0, "update mode flag", updateMode);
 
     // visual : interactive display mode
Index: trunk/psphot/src/psphotStackImageLoop.c
===================================================================
--- trunk/psphot/src/psphotStackImageLoop.c	(revision 38383)
+++ trunk/psphot/src/psphotStackImageLoop.c	(revision 38384)
@@ -30,4 +30,5 @@
 
     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
+    bool updateMode = psMetadataLookupBool(&status, config->arguments, "PSPHOT.STACK.UPDATEMODE");
 
     // just load the full set of images up front except for EXPNUM which we defer
@@ -61,9 +62,17 @@
 
 		// XXX for now, we assume there is only a single chip in the PHU:
-		if (!psphotStackReadout (config, view)) {
-                    psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
-                    psFree (view);
-                    return false;
-		}
+                if (!updateMode) {
+                    if (!psphotStackReadout (config, view)) {
+                        psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
+                        psFree (view);
+                        return false;
+                    }
+                } else {
+                    if (!psphotStackUpdateReadout (config, view)) {
+                        psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
+                        psFree (view);
+                        return false;
+                    }
+                }
 
 		UpdateHeadersForReadout(config, view);
Index: trunk/psphot/src/psphotStackParseCamera.c
===================================================================
--- trunk/psphot/src/psphotStackParseCamera.c	(revision 38383)
+++ trunk/psphot/src/psphotStackParseCamera.c	(revision 38384)
@@ -18,4 +18,5 @@
     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     bool savePSF = psMetadataLookupBool(&status, recipe, "SAVE.PSF");
+    // XXX: bills: I don't think psphotStack will work if SAVE.BACKMDL is false
     bool saveBackgroundModel = psMetadataLookupBool(&status, recipe, "SAVE.BACKMDL");
     bool saveBackground = psMetadataLookupBool(&status, recipe, "SAVE.BACKGND");
@@ -26,4 +27,12 @@
     bool saveChisq = psMetadataLookupBool(&status, recipe, "SAVE.CHISQ");
     bool useRaw = psMetadataLookupBool(&status, recipe, "PSPHOT.STACK.USE.RAW");
+
+    bool updateMode = psMetadataLookupBool(&status, config->arguments, "PSPHOT.STACK.UPDATEMODE");
+    if (updateMode) {
+        // Tell the sources reader to save a copy of the header from the input sources file on
+        // readout->analysis so that we can copy some metadata from measurements that are skipped
+        // in update mode from there to the analysis structure.
+        psMetadataAddBool(recipe, PS_LIST_TAIL, "SAVE.INPUT.SOURCES.HEADER", PS_META_REPLACE, "", true);
+    }
 
 
@@ -65,8 +74,16 @@
 		}
 	    }
-	    psString psf = psMetadataLookupStr(&status, input, "RAW:PSF"); // Name of mask
+	    psString psf = psMetadataLookupStr(&status, input, "RAW:PSF"); // Name of psf
 	    if (psf && strlen(psf) > 0) {
-		if (!defineFile(config, rawInputFile, "PSPHOT.STACK.PSF.RAW", psf, PM_FPA_FILE_PSF)) {
+		// if (!defineFile(config, rawInputFile, "PSPHOT.STACK.PSF.RAW", psf, PM_FPA_FILE_PSF)) {
+		if (!defineFile(config, rawInputFile, "PSPHOT.PSF.LOAD", psf, PM_FPA_FILE_PSF)) {
 		    psError(PS_ERR_UNKNOWN, false, "Unable to define file from psf %d (%s)", i, psf);
+		    return false;
+		}
+	    }
+	    psString backmdl = psMetadataLookupStr(&status, input, "RAW:BACKMDL"); // Name of background model
+	    if (backmdl && strlen(backmdl) > 0) {
+		if (!defineFile(config, NULL, "PSPHOT.STACK.BACKMDL.RAW", backmdl, PM_FPA_FILE_IMAGE)) {
+		    psError(PS_ERR_UNKNOWN, false, "Unable to define file from backmdl %d (%s)", i, backmdl);
 		    return false;
 		}
@@ -144,11 +161,13 @@
         }
 
-	psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of mask
-	if (sources && strlen(sources) > 0) {
-	    if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) {
-		psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources);
-		return false;
-	    }
-	}
+        psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of sources
+        if (sources && strlen(sources) > 0) {
+            // input sources are not bound to fpa. 
+            // XXX: bills: I believe that they are only required in -updatemode now.
+            if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources);
+                return false;
+            }
+        }
 
         psS64 stack_id = psMetadataLookupS64(&status, input, "STACK_ID");
@@ -207,5 +226,6 @@
                     return false;
                 }
-                output->save = true;
+                // don't save psf in update mode?
+                output->save = !updateMode;
                 output->fileID = stack_id;
             }
@@ -219,5 +239,7 @@
                 }
 
-                output->save = true;
+                // do not save the background model file when in update mode. We need to create the file above
+                // but we don't need save it.
+                output->save = !updateMode;
                 output->fileID = stack_id;
             }
