Index: trunk/ppStack/src/ppStackCombineFinal.c
===================================================================
--- trunk/ppStack/src/ppStackCombineFinal.c	(revision 27400)
+++ trunk/ppStack/src/ppStackCombineFinal.c	(revision 27402)
@@ -14,6 +14,6 @@
 //#define TESTING                         // Enable test output
 
-bool ppStackCombineFinal(ppStackThreadData *stack, psArray *covariances, ppStackOptions *options,
-                         pmConfig *config, bool safe, bool normalise, bool grow)
+bool ppStackCombineFinal(pmReadout *target, ppStackThreadData *stack, psArray *covariances,
+                         ppStackOptions *options, pmConfig *config, bool safe, bool normalise, bool grow)
 {
     psAssert(stack, "Require stack");
@@ -21,7 +21,5 @@
     psAssert(config, "Require configuration");
 
-    pmReadout *outRO = options->outRO;                                      // Output readout
-    pmReadout *expRO = options->expRO;                                      // Exposure readout
-    int numCols = outRO->image->numCols, numRows = outRO->image->numRows; // Size of image
+    int numCols = target->image->numCols, numRows = target->image->numRows; // Size of image
 
     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
@@ -45,9 +43,6 @@
     }
 
-    if (!outRO->mask) {
-        outRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
-    }
-    if (!expRO->mask) {
-        expRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
+    if (!target->mask) {
+        target->mask = psImageAlloc(target->image->numCols, target->image->numRows, PS_TYPE_IMAGE_MASK);
     }
 
@@ -67,6 +62,7 @@
         }
 
-        // call: ppStackReadoutFinal(config, outRO, readouts, rejected)
+        // call: ppStackReadoutFinal(config, target, readouts, rejected)
         psThreadJob *job = psThreadJobAlloc("PPSTACK_FINAL_COMBINE"); // Job to start
+        psArrayAdd(job->args, 1, target);
         psArrayAdd(job->args, 1, thread);
         psArrayAdd(job->args, 1, reject);
@@ -109,11 +105,11 @@
         }
         if (sumWeights > 0.0) {
-            outRO->covariance = psImageCovarianceSum(covariances);
-            psBinaryOp(outRO->covariance->image, outRO->covariance->image, "/",
+            target->covariance = psImageCovarianceSum(covariances);
+            psBinaryOp(target->covariance->image, target->covariance->image, "/",
                        psScalarAlloc(sumWeights, PS_TYPE_F32));
-            psImageCovarianceTransfer(outRO->variance, outRO->covariance);
+            psImageCovarianceTransfer(target->variance, target->covariance);
         }
     } else {
-        outRO->covariance = psImageCovarianceNone();
+        target->covariance = psImageCovarianceNone();
     }
 
@@ -131,6 +127,6 @@
             wcsDone = true;
             pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU
-            pmHDU *outHDU = pmHDUFromCell(outRO->parent); // Output HDU
-            pmChip *outChip = outRO->parent->parent; // Output chip
+            pmHDU *outHDU = pmHDUFromCell(target->parent); // Output HDU
+            pmChip *outChip = target->parent->parent; // Output chip
             pmFPA *outFPA = outChip->parent; // Output FPA
             if (!outHDU || !inHDU) {
@@ -155,26 +151,6 @@
     }
 
-    // Set exposure time correctly
-    {
-        float exptime = 0.0;            // Summed exposure time
-        for (int i = 0; i < options->num; i++) {
-            if (options->inputMask) {
-                continue;
-            }
-            exptime += options->exposures->data.F32[i];
-        }
-
-        {
-            psMetadataItem *item = psMetadataLookup(outRO->parent->concepts, "CELL.EXPOSURE");
-            item->data.F32 = exptime;
-        }
-        {
-            psMetadataItem *item = psMetadataLookup(outRO->parent->parent->parent->concepts, "FPA.EXPOSURE");
-            item->data.F32 = exptime;
-        }
-    }
-
     // Put version information into the header
-    pmHDU *hdu = pmHDUFromCell(outRO->parent);
+    pmHDU *hdu = pmHDUFromCell(target->parent);
     if (!hdu) {
         psError(PPSTACK_ERR_PROG, false, "Unable to find HDU for output.");
@@ -192,12 +168,12 @@
     psStringAppend(&name, "combined_image_final_%d.fits", pass);
     pass++;
-    ppStackWriteImage(name, NULL, outRO->image, config);
+    ppStackWriteImage(name, NULL, target->image, config);
     psStringSubstitute(&name, "mask", "image");
-    ppStackWriteImage(name, NULL, outRO->mask, config);
+    ppStackWriteImage(name, NULL, target->mask, config);
     psStringSubstitute(&name, "variance", "mask");
-    ppStackWriteImage(name, NULL, outRO->variance, config);
+    ppStackWriteImage(name, NULL, target->variance, config);
     psFree(name);
 
-    pmStackVisualPlotTestImage(outRO->image, "combined_image_final.fits");
+    pmStackVisualPlotTestImage(target->image, "combined_image_final.fits");
 #endif
 
