Index: trunk/ppImage/src/ppImageLoop.c
===================================================================
--- trunk/ppImage/src/ppImageLoop.c	(revision 6148)
+++ trunk/ppImage/src/ppImageLoop.c	(revision 6260)
@@ -1,16 +1,12 @@
-# include "ppImage.h"
+#include <stdio.h>
+#include "pslib.h"
+#include "pmFPA.h"
+#include "pmFPARead.h"
+#include "pmChipMosaic.h"
+#include "pmFPAWrite.h"
+#include "ppImageDetrend.h"
+#include "ppImage.h"
 
 #define MEM_LEAKS 1
-
-psMemId ppMemPrint(const psMemBlock *ptr)
-{
-    psLogMsg(__func__, PS_LOG_INFO,
-             "Memory block %d (%ld):\n"
-             "\tFile %s, line %d, size %d\n"
-             "\tPosts: %lx %lx %lx\n",
-             ptr->id, ptr->refCounter, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock,
-             ptr->endblock, *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize));
-    return 0;
-}
 
 // Read the entire FPA
@@ -46,7 +42,7 @@
 
 
-bool ppImageLoop(ppData *data, ppOptions *options, ppConfig *config)
+bool ppImageLoop(ppImageData *data, ppImageOptions *options, ppConfig *config)
 {
-    ppDetrend detrend;
+    ppImageDetrend detrend;
 
     int processChip = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to process or -1
@@ -83,6 +79,4 @@
         pmChip *flatChip  = data->flat->fpa->chips->data[i];
 
-        ppMemPrint((psMemBlock*)inputChip-1);
-
         psArray *cells = inputChip->cells;
         for (int j = 0; j < cells->n; j++) {
@@ -104,5 +98,5 @@
             }
 
-            ppDetrendCell(&detrend, options, config);
+            ppImageDetrendCell(&detrend, options, config);
 
             // Need to free detrend cells here so we have enough memory to do other stuff
@@ -130,5 +124,4 @@
 #ifndef MEM_LEAKS
         pmChipFreeCells(inputChip);
-        ppMemPrint((psMemBlock*)chips->data[i]-1);
 #endif
     }
