Index: /trunk/pswarp/src/pswarp.c
===================================================================
--- /trunk/pswarp/src/pswarp.c	(revision 18923)
+++ /trunk/pswarp/src/pswarp.c	(revision 18924)
@@ -2,9 +2,9 @@
 
 static void usage (void) {
-    fprintf (stderr, "USAGE: pswarp [-file image(s)] [-list imagelist] [options] (output) (skycell)\n");
-    fprintf (stderr, "  options:\n");
-    fprintf (stderr, "    [-astrom astrom.cmp] : provide an alternative astrometry calibration\n");
-    fprintf (stderr, "    [-mask mask.fits] : provide a corresponding mask image\n");
-    fprintf (stderr, "    [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n");
+    fprintf(stderr, "USAGE: pswarp [-file image(s)] [-list imagelist] [options] (output) (skycell)\n");
+    fprintf(stderr, "  options:\n");
+    fprintf(stderr, "    [-astrom astrom.cmp] : provide an alternative astrometry calibration\n");
+    fprintf(stderr, "    [-mask mask.fits] : provide a corresponding mask image\n");
+    fprintf(stderr, "    [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n");
     psErrorStackPrint(stderr, "\n");
     exit (2);
@@ -24,13 +24,13 @@
     if (!config) usage();
 
-    if (!pswarpOptions(config)) {
-        psErrorStackPrint(stderr, "error parsing options\n");
-        exit(1);
-    }
-
     // load identify the data sources
     if (!pswarpParseCamera(config)) {
         psErrorStackPrint(stderr, "error setting up the camera\n");
-        exit (1);
+        exit(PS_EXIT_CONFIG_ERROR);
+    }
+
+    if (!pswarpOptions(config)) {
+        psErrorStackPrint(stderr, "error parsing options\n");
+        exit(PS_EXIT_SYS_ERROR);
     }
 
@@ -38,5 +38,5 @@
     if (!pswarpDefine(config)) {
         psErrorStackPrint(stderr, "error loading output definition\n");
-        exit (1);
+        exit(PS_EXIT_CONFIG_ERROR);
     }
 
@@ -44,5 +44,5 @@
     if (!pswarpLoop(config)) {
         psErrorStackPrint(stderr, "error warping data\n");
-        exit (1);
+        exit(PS_EXIT_DATA_ERROR);
     }
 
@@ -50,4 +50,4 @@
     pswarpCleanup(config);
     psLibFinalize();
-    exit(EXIT_SUCCESS);
+    exit(PS_EXIT_SUCCESS);
 }
Index: /trunk/pswarp/src/pswarpArguments.c
===================================================================
--- /trunk/pswarp/src/pswarpArguments.c	(revision 18923)
+++ /trunk/pswarp/src/pswarpArguments.c	(revision 18924)
@@ -44,11 +44,11 @@
     if ((N = psArgumentGet(argc, argv, "-threads"))) {
         psArgumentRemove(N, &argc, argv);
-	int nThreads = atoi(argv[N]);
+        int nThreads = atoi(argv[N]);
         psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);
         psArgumentRemove(N, &argc, argv);
 
-	// create the thread pool with number of desired threads, supplying our thread launcher function
-	// XXX need to determine the number of threads from the config data
-	psThreadPoolInit (nThreads);
+        // create the thread pool with number of desired threads, supplying our thread launcher function
+        // XXX need to determine the number of threads from the config data
+        psThreadPoolInit (nThreads);
     }
     pswarpSetThreads ();
@@ -94,5 +94,5 @@
 {
     // Select the appropriate recipe
-    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
+    psMetadata *recipe  = psMetadataLookupPtr(NULL, config->recipes, PSWARP_RECIPE);
     if (!recipe) {
         psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE);
@@ -102,22 +102,27 @@
     // Get grid size
     bool status;                        // Status of MD lookup
-    int nGridX = psMetadataLookupS32 (&status, recipe, "GRID.NX");
-    if (!status) nGridX = 128;
-    int nGridY = psMetadataLookupS32 (&status, recipe, "GRID.NY");
-    if (!status) nGridY = 128;
+    int nGridX = psMetadataLookupS32(&status, recipe, "GRID.NX");
+    if (!status || nGridX <= 0) {
+        nGridX = 128;
+        psWarning("GRID.NX is not set in the recipe --- defaulting to %d", nGridX);
+    }
+    int nGridY = psMetadataLookupS32(&status, recipe, "GRID.NY");
+    if (!status) {
+        nGridY = 128;
+        psWarning("GRID.NY is not set in the recipe --- defaulting to %d", nGridY);
+    }
 
     // Get interpolation mode
-    psImageInterpolateMode interpolationMode; // Mode for interpolation
     const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode
     if (!name) {
+        name = "BILINEAR";
+        psLogMsg("pswarp", 3, "defaulting to %s interpolation", name);
+    }
+    psImageInterpolateMode interpolationMode = psImageInterpolateModeFromString(name); // Mode for interp.
+    if (interpolationMode == PS_INTERPOLATE_NONE) {
         interpolationMode = PS_INTERPOLATE_BILINEAR;
-        psLogMsg ("pswarp", 3, "defaulting to bilinear interpolation\n");
-    } else {
-        interpolationMode = psImageInterpolateModeFromString (name);
-        if (interpolationMode == PS_INTERPOLATE_NONE) {
-            interpolationMode = PS_INTERPOLATE_BILINEAR;
-            psLogMsg ("pswarp", 3,
-                      "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name);
-        }
+        psLogMsg ("pswarp", 3,
+                  "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name);
+        name = "BILINEAR";
     }
 
@@ -134,4 +139,16 @@
     }
 
+    // Set recipe values in the recipe (since we've possibly altered some)
+    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE,
+                     "Iso-astrom grid spacing in x", nGridX);
+    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE,
+                     "Iso-astrom grid spacing in y", nGridY);
+    psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE,
+                     "Interpolation mode", name);
+    psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
+                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
+    psMetadataAddF32(recipe, PS_LIST_TAIL, "ACCEPT.FRAC", PS_META_REPLACE,
+                     "Minimum fraction of good pixels for result to be accepted", acceptFrac);
+
     // Set recipe values in the arguments
     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0,
@@ -147,4 +164,17 @@
 
     psTrace("pswarp", 1, "Done with pswarpArguments...\n");
+
+    // Dump configuration, now that's it's settled
+    {
+        pmConfigCamerasCull(config);
+        pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS");
+
+        const char *outroot = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Output root name
+        psAssert(outroot, "Should be there, we put it there!");
+
+        pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
+        pmConfigDump(config, input->fpa, outroot);
+    }
+
     return (config);
 }
Index: /trunk/pswarp/src/pswarpLoop.c
===================================================================
--- /trunk/pswarp/src/pswarpLoop.c	(revision 18923)
+++ /trunk/pswarp/src/pswarpLoop.c	(revision 18924)
@@ -64,5 +64,5 @@
 bool pswarpLoop(pmConfig *config)
 {
-    bool status; 
+    bool status;
 
     // load the recipe
@@ -74,5 +74,5 @@
 
     // output mask bits
-    psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT"); 
+    psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");
     psAssert (status, "MASK.OUTPUT was not defined");
 
Index: /trunk/pswarp/src/pswarpParseCamera.c
===================================================================
--- /trunk/pswarp/src/pswarpParseCamera.c	(revision 18923)
+++ /trunk/pswarp/src/pswarpParseCamera.c	(revision 18924)
@@ -1,6 +1,6 @@
 # include "pswarp.h"
 
-bool pswarpParseCamera (pmConfig *config) {
-
+bool pswarpParseCamera(pmConfig *config)
+{
     bool status;
     bool mdok;                          // Status of MD lookup
@@ -38,5 +38,5 @@
         psLogMsg ("pswarp", 3, "no mask supplied\n");
     }
-    
+
     // loading the mask here should have invoked pmConfigMaskReadHeader()
     if (!pswarpSetMaskBits (config)) {
