Index: trunk/dvoTools/src/dvoApplyCorrArguments.c
===================================================================
--- trunk/dvoTools/src/dvoApplyCorrArguments.c	(revision 11862)
+++ trunk/dvoTools/src/dvoApplyCorrArguments.c	(revision 11877)
@@ -6,5 +6,5 @@
 
 static void usage (void) {
-    fprintf(stderr, "USAGE: dvoApplyCorr -file INPUT.fits OUTPUT\n\n");
+    fprintf(stderr, "USAGE: dvoApplyCorr -file INPUT.fits OUTPUT [-corr CORR.fits]\n\n");
     exit (2);
 }
Index: trunk/dvoTools/src/dvoApplyCorrLoop.c
===================================================================
--- trunk/dvoTools/src/dvoApplyCorrLoop.c	(revision 11862)
+++ trunk/dvoTools/src/dvoApplyCorrLoop.c	(revision 11877)
@@ -14,4 +14,5 @@
     // psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, RECIPE_NAME);
 
+    // select the input image
     pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "DVOFLAT.INPUT");
     if (!status) {
@@ -22,7 +23,7 @@
     pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest
 
-    // load data at FPA leve
+    // load data at FPA level
     if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
-	psError(PS_ERR_UNKNOWN, false, "failed IO for fpa in psphot\n");
+	psError(PS_ERR_UNKNOWN, false, "failed IO for fpa in dvoApplyCorr\n");
 	psFree(view);
         return false;
@@ -34,5 +35,5 @@
         if (!chip->process || !chip->file_exists) continue;
 	if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
-            psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in psphot\n", view->chip);
+            psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in dvoApplyCorr\n", view->chip);
 	    psFree (view);
 	    return false;
@@ -43,24 +44,30 @@
             psLogMsg ("dvoApplyCorrLoop", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
             if (!cell->process || !cell->file_exists) continue;
-            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE))
-		psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d in psphot\n", view->chip, view->cell);
-	    psFree (view);
-	    return false;
-	}
-
-	// process each of the readouts
-	while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
-	    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
-		psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in psphot\n", view->chip, view->cell, view->readout);
+            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+		psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d in dvoApplyCorr\n", view->chip, view->cell);
 		psFree (view);
 		return false;
 	    }
-	    if (!readout->data_exists) continue;
 
-	    // XXX put the function here which multiplies the input image and the correction image
-	    dvoApplyCorrReadout (config, view, "DVOFLAT.INPUT", "DVOFLAT.CORR");
+	    // process each of the readouts
+	    while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
+		if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+		    psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in dvoApplyCorr\n", view->chip, view->cell, view->readout);
+		    psFree (view);
+		    return false;
+		}
+		if (!readout->data_exists) continue;
 
+		// XXX put the function here which multiplies the input image and the correction image
+		dvoApplyCorrReadout (config, view, "DVOFLAT.INPUT", "DVOFLAT.CORR");
+
+		if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
+		    psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in dvoApplyCorr\n", view->chip, view->cell, view->readout);
+		    psFree (view);
+		    return false;
+		}
+	    }
 	    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
-		psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in psphot\n", view->chip, view->cell, view->readout);
+		psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d in dvoApplyCorr\n", view->chip, view->cell);
 		psFree (view);
 		return false;
@@ -68,5 +75,5 @@
 	}
 	if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
-	    psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d in psphot\n", view->chip, view->cell);
+	    psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in dvoApplyCorr\n", view->chip);
 	    psFree (view);
 	    return false;
@@ -74,5 +81,5 @@
     }
     if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
-	psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in psphot\n", view->chip);
+	psError(PS_ERR_UNKNOWN, false, "failed IO for fpa in dvoApplyCorr\n");
 	psFree (view);
 	return false;
