Index: trunk/ppStack/src/ppStackLoop.c
===================================================================
--- trunk/ppStack/src/ppStackLoop.c	(revision 18168)
+++ trunk/ppStack/src/ppStackLoop.c	(revision 18346)
@@ -17,5 +17,5 @@
 
 // Files required in preparation for convolution
-static char *prepareFiles[] = { "PPSTACK.INPUT.PSF", "PPSTACK.SOURCES", NULL };
+static char *prepareFiles[] = { "PPSTACK.INPUT.PSF", "PPSTACK.INPUT.SOURCES", NULL };
 
 // Files required for the convolution
@@ -213,6 +213,7 @@
     // Preparation iteration: Load the sources, and get a target PSF model
     psTrace("ppStack", 1, "Determining target PSF....\n");
-    pmReadout *sources = NULL;          // Readout with sources to use for PSF matching
+    psArray *sources = NULL;            // Sources to use for PSF matching
     pmPSF *targetPSF = NULL;            // Target PSF
+    bool haveSources = psMetadataLookupBool(NULL, config->arguments, "HAVE.SOURCES"); // Global sources?
     if (psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) {
         pmFPAfileActivate(config->files, false, NULL);
@@ -223,12 +224,4 @@
         }
 
-        // We want to hang on to the 'sources' even when its host FPA is blown away
-        sources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view, "PPSTACK.SOURCES"));
-        if (!sources) {
-            psError(PS_ERR_UNKNOWN, true, "Unable to find sources.");
-            psFree(view);
-            return false;
-        }
-
         // Generate list of PSFs
         psMetadataIterator *fileIter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD,
@@ -236,4 +229,5 @@
         psMetadataItem *fileItem; // Item from iteration
         psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope
+        psArray *sourceLists = NULL;    // Source lists for merging sources from multiple readouts
         int numCols = 0, numRows = 0;   // Size of image
         int index = 0;                  // Index for file
@@ -247,4 +241,5 @@
                 psFree(view);
                 psFree(sources);
+                psFree(sourceLists);
                 psFree(fileIter);
                 psFree(psfs);
@@ -263,4 +258,5 @@
                 psFree(view);
                 psFree(sources);
+                psFree(sourceLists);
                 psFree(fileIter);
                 psFree(psfs);
@@ -270,4 +266,17 @@
                 numCols = naxis1;
                 numRows = naxis2;
+            }
+
+            if (!haveSources) {
+                pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
+                sourceLists = ppStackSourceListAdd(sourceLists, ro, config);
+                if (!sourceLists) {
+                    psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list.");
+                    psFree(view);
+                    psFree(sources);
+                    psFree(fileIter);
+                    psFree(psfs);
+                    return false;
+                }
             }
         }
@@ -281,4 +290,23 @@
             psFree(sources);
             return false;
+        }
+
+        if (haveSources) {
+            // We want to hang on to the 'sources' even when its host FPA is blown away
+            sources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view, "PPSTACK.INPUT.SOURCES"));
+            if (!sources) {
+                psError(PS_ERR_UNKNOWN, true, "Unable to find sources.");
+                psFree(view);
+                return false;
+            }
+        } else {
+            sources = ppStackSourceListCombine(sourceLists, config);
+            psFree(sourceLists);
+            if (!sources) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list.");
+                psFree(view);
+                psFree(psfs);
+                return false;
+            }
         }
 
