Index: /trunk/stac/src/Makefile
===================================================================
--- /trunk/stac/src/Makefile	(revision 3672)
+++ /trunk/stac/src/Makefile	(revision 3673)
@@ -5,13 +5,17 @@
 LDFLAGS += $(PSLIB)
 
-STAC = stac.o stacConfig.o stacRead.o stacErrorImages.o stacTransform.o stacCheckMemory.o \
-	stacCombine.o stacInvertMaps.o stacRejection.o stacAreaOfInterest.o stacSize.o stacScales.o \
-	stacHelp.o
+STAC = stac.o stacConfig.o stacRead.o stacErrorImages.o stacTransform.o stacCheckMemory.o stacHelp.o \
+	stacCombine.o stacInvertMaps.o stacRejection.o stacAreaOfInterest.o stacSize.o stacScales.o time.o
 
 SHIFT = shift.o stacRead.o stacTransform.o stacCheckMemory.o stacInvertMaps.o stacSize.o
 
+COMBINE = combine.o combineConfig.o stacRead.o stacErrorImages.o stacCombine.o stacScales.o \
+	stacCheckMemory.o time.o
+
 SHIFTSIZE = shiftSize.o stacWrite.o stacConfig.o stacRead.o stacCheckMemory.o stacSize.o
 
-.PHONY: tags clean empty test profile optimise
+TARGETS = stac shift combine shiftSize
+
+.PHONY: tags clean empty test profile optimise all
 
 .c.o:
@@ -24,6 +28,11 @@
 		$(CC) $(CFLAGS) -o $@ $(SHIFT) $(LDFLAGS) $(OPTFLAGS)
 
+combine:	$(COMBINE)
+		$(CC) $(CFLAGS) -o $@ $(COMBINE) $(LDFLAGS) $(OPTFLAGS)
+
 shiftSize:	$(SHIFTSIZE)
 		$(CC) $(CFLAGS) -o $@ $(SHIFTSIZE) $(LDFLAGS) $(OPTFLAGS)
+
+all:		$(TARGETS)
 
 clean:
@@ -31,5 +40,5 @@
 
 empty:		clean
-		-$(RM) $(TARGET) TAGS
+		-$(RM) $(TARGETS) TAGS
 
 test:		stac test_0.fits test_1.fits test_2.fits test_3.fits
Index: /trunk/stac/src/shift.c
===================================================================
--- /trunk/stac/src/shift.c	(revision 3672)
+++ /trunk/stac/src/shift.c	(revision 3673)
@@ -11,11 +11,11 @@
 {
     fprintf (stderr, "shift: shift an image, given the transformation\n"
-	     "Usage: %s [-h] [-v] [-s NX NY] OUT IN\n"
+	     "Usage: %s [-h] [-v] [-s NX NY] IN OUT\n"
 	     "where\n"
 	     "\t-h           Help (this info)\n"
 	     "\t-v           Increase verbosity level\n"
 	     "\t-s NX NY     Size of output image\n"
-	     "\tOUT          Output image\n"
-	     "\tIN           Input image, which has associated .map file.\n",
+	     "\tIN           Input image, which has associated .map file\n"
+	     "\tOUT          Output image\n",
 	     programName
 	);
Index: /trunk/stac/src/stac.c
===================================================================
--- /trunk/stac/src/stac.c	(revision 3672)
+++ /trunk/stac/src/stac.c	(revision 3673)
@@ -5,16 +5,6 @@
 #include <sys/time.h>
 
-double getTime(void)
-/* Gets the current time.  Got this from Nick Kaiser's fetchpix.c */
-{
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    return(tv.tv_sec + 1.e-6 * tv.tv_usec);
-}
-
-
 int main(int argc, char **argv)
 {
-
     double startTime = getTime();
 
Index: /trunk/stac/src/stac.h
===================================================================
--- /trunk/stac/src/stac.h	(revision 3672)
+++ /trunk/stac/src/stac.h	(revision 3673)
@@ -3,8 +3,10 @@
 
 #include "pslib.h"
-
 #define abs(x) ((x) >= 0 ? (x) : (-(x)))
-
 #define MAXCHAR 80
+
+/************************************************************************************************************/
+
+// time.c
 
 // Get the current time
Index: /trunk/stac/src/stacCombine.c
===================================================================
--- /trunk/stac/src/stacCombine.c	(revision 3672)
+++ /trunk/stac/src/stacCombine.c	(revision 3673)
@@ -67,4 +67,13 @@
     )
 {
+    assert(combined);
+    assert(images);
+    assert(errors);
+    assert(images->n == errors->n);
+    assert(saturated);
+    assert(bad);
+    assert(saturated->n == images->n);
+    assert(bad->n == images->n);
+
     int nImages = images->n;		// Number of images
     int numRows = ((psImage*)images->data[0])->numRows;	// Image size
Index: /trunk/stac/src/stacScales.c
===================================================================
--- /trunk/stac/src/stacScales.c	(revision 3672)
+++ /trunk/stac/src/stacScales.c	(revision 3673)
@@ -121,4 +121,5 @@
 	    starCoordsTransformed->data[i] = psPlaneTransformApply(NULL, starMap, starCoords->data[i]);
 	}
+	psFree(starMap);
 
 	psArray *stars = psArrayAlloc(images->n); // Array of stellar photometry vectors
@@ -175,4 +176,6 @@
 	    masks->data[i] = mask;
 	}
+	psFree(starCoords);
+	psFree(starCoordsTransformed);
 
 	// Get the scales
