Index: trunk/psphot/src/psphot.c
===================================================================
--- trunk/psphot/src/psphot.c	(revision 4189)
+++ trunk/psphot/src/psphot.c	(revision 4215)
@@ -4,13 +4,10 @@
 int main (int argc, char **argv) {
 
-    psMetadata *config  = NULL;		// user-provided configuration information
-    psMetadata *header  = NULL;		// input image header
-    psImage    *image   = NULL;		// input image data
-    psImage    *noise   = NULL;		// input image data
-    psImage    *mask    = NULL;		// input image data
-    psArray    *sources = NULL;
-    psArray    *peaks   = NULL;		// a list of pmPeaks 
-    pmPSF      *psf     = NULL;
-    psStats    *sky     = NULL;
+    psMetadata  *config  = NULL;		// user-provided configuration information
+    psImageData *imdata  = NULL;
+    psArray     *sources = NULL;
+    psArray     *peaks   = NULL;		// a list of pmPeaks 
+    pmPSF       *psf     = NULL;
+    psStats     *sky     = NULL;
 
     psLogArguments (&argc, argv);
@@ -20,14 +17,14 @@
     // load input data (image and config)
     // create or load mask and noise images
-    setup (&image, &mask, &noise, &header, config);
+    imdata = setup (config);
 
     // measure image stats for initial guess 
-    sky = image_stats (image, config);
+    sky = image_stats (imdata, config);
 
     // find the peaks in the image
-    peaks = find_peaks (image, config, sky);
+    peaks = find_peaks (imdata, config, sky);
 
     // construct sources and measure basic stats
-    sources = source_moments (image, config, peaks);
+    sources = source_moments (imdata, config, peaks);
 
     // source analysis is done in S/N order (brightest first)
