Index: trunk/psphot/src/source_moments.c
===================================================================
--- trunk/psphot/src/source_moments.c	(revision 4129)
+++ trunk/psphot/src/source_moments.c	(revision 4215)
@@ -1,5 +1,5 @@
 # include "psphot.h"
 
-psArray *source_moments (psImage *image, psMetadata *config, psArray *allpeaks) 
+psArray *source_moments (psImageData *imdata, psMetadata *config, psArray *allpeaks) 
 {
     bool     status  = false;
@@ -8,16 +8,4 @@
 
     psTimerStart ("psphot");
-
-    // reduce the initial peaks to a subset of the better peaks
-    // is this the appropriate place for this culling?
-
-    float XBORDER  = psMetadataLookupF32 (&status, config, "XBORDER");
-    float YBORDER  = psMetadataLookupF32 (&status, config, "YBORDER");
-    float SATURATE = psMetadataLookupF32 (&status, config, "SATURATE");
-
-    psRegion *keep = psRegionAlloc (XBORDER, -XBORDER, YBORDER, -YBORDER);
-    keep           = psRegionForImage (keep, image, keep);
-    // I need to exclude the saturated objects here, but include them again later...?
-    peaks          = pmPeaksSubset (allpeaks, 100000, keep);
 
     // determine properties (sky, moments) of initial sources
@@ -32,7 +20,8 @@
     for (int i = 0; i < peaks->n; i++) {
 	// provide the user arguments as metadata?
-	psSource *source  = pmSourceLocalSky (image, (psPeak *)peaks->data[i], PS_STAT_SAMPLE_MEDIAN, INNER, OUTER);
+	psSource *source  = pmSourceDefinePixels (imdata, (psPeak *)peaks->data[i], OUTER);
 	if (source == NULL) continue;
-	pmSourceMaskRegion (source, keep);
+
+	pmSourceLocalSky_EAM (source, PS_STAT_SAMPLE_MEDIAN, INNER);
 	pmSourceMoments (source, RADIUS);
 	psArrayAdd (sources, 100, source);
