Index: trunk/ppImage/src/ppImage.c
===================================================================
--- trunk/ppImage/src/ppImage.c	(revision 6775)
+++ trunk/ppImage/src/ppImage.c	(revision 6817)
@@ -1,40 +1,24 @@
-#include <stdio.h>
-#include "pslib.h"
-#include "psmodules.h"
 #include "ppImage.h"
-#include "ppMem.h"
 
-int main(int argc, char **argv)
-{
-//    psErrorRegister(NULL, -1);
-
-    ppImageData *data = ppImageDataAlloc();
-    ppImageOptions *options = ppImageOptionsAlloc();
+int main(int argc, char **argv) {
 
     psTimerStart(TIMERNAME);
 
     // Parse the configuration and arguments
+    // Open the input image(s)
+    // Determine camera, format from header if not already defined
+    // Construct camera in preparation for reading
     pmConfig *config = ppImageConfig(argc, argv);
 
-    // Open the input image, output image, output mask
-    // Get camera configuration from header if not already defined
-    // Construct camera in preparation for reading
-    ppImageParseCamera(data, config);
+    // Set various tasks (define optional operations)
+    ppImageOptions *options = ppImageOptionsParse(config);
 
-    // Set various tasks (define optional operations)
-    ppImageOptionsParse(data, options, config);
-
-#if 0
-    // XXX I think we do this in ppImageParseCamera
-
-    // open detrend images, load headers, optionally load pixels
-    ppImageParseDetrend(data, options, config);
-#endif
+    // define the active I/O files
+    ppImageParseDetrend(options, config);
 
     // Image Arithmetic Loop
-    ppImageLoop(data, options, config);
+    ppImageLoop(options, config);
 
     // Cleaning up
-    psFree(data);
     psFree(options);
     psFree(config);
@@ -43,6 +27,6 @@
     pmConceptsDone();
     pmConfigDone();
-    ppMemCheck();
-
+    // ppMemCheck();
+    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "ppImage");
     return EXIT_SUCCESS;
 }
