Index: trunk/psphot/src/psphot.c
===================================================================
--- trunk/psphot/src/psphot.c	(revision 4115)
+++ trunk/psphot/src/psphot.c	(revision 4129)
@@ -1,3 +1,4 @@
 # include "psphot.h"
+void dump_image (psImage *image, char *filename);
 
 int main (int argc, char **argv) {
@@ -33,4 +34,10 @@
     psf = choose_psf_model (image, config, sources);
 
+    psImage *zap = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
+    psImageInit (zap, 0);
+    find_defects (zap, sources, config, psf);
+    dump_image (zap, argv[2]);
+    exit (0);
+
     // test PSF on all except SATURATE and DEFECT (artifacts)
     apply_psf_model (image, config, sources, psf, sky);
@@ -44,10 +51,5 @@
     // subtract_galaxies (sources, config);
  
-    // write out subtracted image
-    unlink (argv[2]);
-    psFits *fits = psFitsAlloc (argv[2]);
-    psFitsWriteImage (fits, NULL, image, 0, NULL);
-    psFree (fits);
-
+    dump_image (image, argv[2]);
     DumpModelPSF (sources, "sources.dat");
     exit (0);
@@ -59,2 +61,12 @@
     exit (2);
 }
+
+void dump_image (psImage *image, char *filename) {
+
+    unlink (filename);
+    psFits *fits = psFitsAlloc (filename);
+    psFitsWriteImage (fits, NULL, image, 0, NULL);
+    psFree (fits);
+    return;
+}
+
