Index: trunk/ppStack/src/ppStackSources.c
===================================================================
--- trunk/ppStack/src/ppStackSources.c	(revision 27329)
+++ trunk/ppStack/src/ppStackSources.c	(revision 27400)
@@ -64,11 +64,6 @@
 
     if (!options->matchZPs && !options->photometry) {
-        int num = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs
-        options->norm = psVectorAlloc(num, PS_TYPE_F32);
-        psVectorInit (options->norm, 0.0);
-
-        // XXX do I need to set this?
-        // options->sumExposure = sumExpTime;
-
+        options->norm = psVectorAlloc(options->num, PS_TYPE_F32);
+        psVectorInit(options->norm, 0.0);
         return true;
     }
@@ -137,5 +132,5 @@
     }
 
-    int num = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs
+    int num = options->num;             // Number of inputs
     psAssert(num == sourceLists->n, "Wrong number of source lists: %ld\n", sourceLists->n);
 
@@ -146,5 +141,4 @@
     float airmassTerm = NAN;            // Airmass term
     float zpTarget = NAN;               // Target zero point
-    float sumExpTime = 0.0;             // Sum of the exposure time
     int numGoodImages = 0;              // Number of good images
     for (int i = 0; i < num; i++) {
@@ -160,5 +154,4 @@
 
         pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File of interest
-        pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
 
 #if defined(TESTING) && 0
@@ -177,5 +170,5 @@
 #endif
 
-        float exptime = psMetadataLookupF32(NULL, cell->concepts, "CELL.EXPOSURE"); // Exposure time
+        float exptime = options->exposures->data.F32[i]; // Exposure time
         float airmass = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.AIRMASS"); // Airmass
         const char *expFilter = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.FILTER"); // Filter name
@@ -221,9 +214,5 @@
 
         zp->data.F32[i] = airmassTerm * airmass + 2.5 * log10(exptime);
-        sumExpTime += exptime;
-
-    }
-
-    options->sumExposure = sumExpTime;
+    }
 
     if (numGoodImages == 0) {
@@ -291,5 +280,5 @@
                 }
                 psArray *sources = sourceLists->data[i]; // Sources of interest
-                float magCorr = zp->data.F32[i] + trans->data.F32[i] - 2.5*log10(sumExpTime);
+                float magCorr = zp->data.F32[i] + trans->data.F32[i] - 2.5*log10(options->sumExposure);
                 if (zpExpNum == numGoodImages) {
                     // Using measured zero points, so attempt to set target zero point
