Index: trunk/psphot/src/psphot.c
===================================================================
--- trunk/psphot/src/psphot.c	(revision 4901)
+++ trunk/psphot/src/psphot.c	(revision 4946)
@@ -9,39 +9,43 @@
     pmPSF       *psf     = NULL;
     psStats     *sky     = NULL;
+    pmPSFClump   psfClump;
 
-    config = load_args (&argc, argv);
+    config = psphotArguments (&argc, argv);
 
     // load input data (image and config)
     // create or load mask and noise images
     // we have memory leaks here -- may be from psMetadata
-    imdata = setup (config);
+    imdata = psphotSetup (config);
 
     // measure image stats for initial guess 
-    sky = image_stats (imdata, config);
+    sky = psphotImageStats (imdata, config);
 
     // find the peaks in the image
-    peaks = find_peaks (imdata, config, sky);
+    peaks = pmPeaksSigmaLimit (imdata, config, sky);
 
     // construct sources and measure basic stats
-    sources = source_moments (imdata, config, peaks);
+    sources = psphotSourceStats (imdata, config, peaks);
 
     // classify sources based on moments, brightness
-    basic_classes (sources, config);
+    // XXX - this has 1 leak
+    psfClump = pmSourcePSFClump (sources, config);
+
+    // group into STAR, COSMIC, GALAXY, SATURATED
+    pmSourceRoughClass (sources, config, psfClump);
 
     // source analysis is done in S/N order (brightest first)
-    sources = psArraySort (sources, by_SN);
+    sources = psArraySort (sources, psphotSortBySN);
 
     // use bright stellar objects to measure PSF
-    psf = choose_psf_model (config, sources, sky);
+    psf = psphotChoosePSF (config, sources, sky);
 
     // test PSF on all except SATURATE and DEFECT (artifacts)
-    apply_psf_model (imdata, config, sources, psf, sky);
+    psphotApplyPSF (imdata, config, sources, psf, sky);
 
     // fit extended objects with galaxy models
-    fit_galaxies (imdata, config, sources, sky);
+    psphotFitGalaxies (imdata, config, sources, sky);
 
     // write out data in appropriate format
-    output (imdata, config, sources);
-
+    psphotOutput (imdata, config, sources);
     exit (0);
 }
