Index: trunk/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- trunk/Ohana/src/relastro/src/ImageOps.c	(revision 27435)
+++ trunk/Ohana/src/relastro/src/ImageOps.c	(revision 27478)
@@ -1,4 +1,4 @@
 # include "relastro.h"
-# define TESTING
+
 # define USE_IMAGE_ID 1
 
@@ -7,11 +7,13 @@
 static off_t       **mlist;   // measure reference for measurement on image
 static off_t        *Nlist;   // number of measurements on image
-static off_t        *NLIST;   // allocated number of measurements on image
+static off_t        *NLIST;   // allocated number of measurements on image   
 
 static Image        *image;   // list of available images
 static off_t        Nimage;   // number of available images
 
+// if we search by image ID, we sort (imageIDs, imageIdx) by imageIDs to get a sorted
+// index
+
 # if USE_IMAGE_ID
-// we sort (imageIDs, imageIdx) by imageIDs to get a sorted index
 static off_t        *imageIDs; // list of all image IDs
 static off_t        *imageIdx; // list of index for image IDs 
@@ -55,5 +57,4 @@
   }
 # endif
-
 }
 
@@ -132,4 +133,7 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Nmeasure; j++) {
+      // XXX : update to optionally restrict by photcode equiv a la relphot
+      // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
+      // if (photcode[0].code != ecode) continue;
       matchImage (catalog, j, i);
     }
@@ -144,5 +148,5 @@
 
 # if USE_IMAGE_ID
-/* modify this function to use the measure->imageID field */
+// this is the imageID-based match
 void matchImage (Catalog *catalog, off_t meas, int cat) {
 
@@ -178,5 +182,5 @@
 
 # else
-/* modify this function to use the measure->imageID field */
+// this is the time-based match
 void matchImage (Catalog *catalog, off_t meas, int cat) {
 
Index: trunk/Ohana/src/relastro/src/MosaicOps.c
===================================================================
--- trunk/Ohana/src/relastro/src/MosaicOps.c	(revision 27435)
+++ trunk/Ohana/src/relastro/src/MosaicOps.c	(revision 27478)
@@ -2,5 +2,5 @@
 
 // array of mosaic definition structures
-static off_t    Nmosaic;
+static off_t   Nmosaic;
 static Mosaic *mosaic;
 
@@ -161,4 +161,7 @@
   }
 
+  free (startMos);
+  free (stopMos);
+  free (indexMos);
   return;
 }
Index: trunk/Ohana/src/relastro/src/relastro.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro.c	(revision 27435)
+++ trunk/Ohana/src/relastro/src/relastro.c	(revision 27478)
@@ -13,5 +13,4 @@
   FITS_DB db;
   struct timeval start, stop;
-
   SkyList *skylist = NULL;
 
Index: trunk/Ohana/src/relastro/src/select_images.c
===================================================================
--- trunk/Ohana/src/relastro/src/select_images.c	(revision 27435)
+++ trunk/Ohana/src/relastro/src/select_images.c	(revision 27478)
@@ -20,7 +20,7 @@
   Image *image;
   off_t i, j, k, m, nStart, iSky, nimage, NIMAGE;
+  off_t *line_number;
   int InRange, found;
   double Ri[5], Di[5], Xi[5], Yi[5], dx, dy;
-  off_t *line_number;
   Coords tcoords;
   SkyRegionCoords *skycoords;
@@ -127,11 +127,9 @@
     found = FALSE;
 
-    /* transform to ra,dec */
+    /* transform corners to ra,dec */
     double RminImage = 360.0;
-    // double RmaxImage =   0.0;
     for (j = 0; j < 5; j++) {
       XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords);
       RminImage = MIN(RminImage, Ri[j]);
-      // RmaxImage = MIN(RmaxImage, Ri[j]);
     }
 
@@ -143,7 +141,4 @@
 
       m = index[iSky];
-      // if (RmaxImage < skylist[0].regions[m][0].Rmin) {
-      // break;
-      // }
 
       /* we make positional comparisons in the projection of catalog */
@@ -180,5 +175,5 @@
       }
       if (RESET) {
-	// XXX do we need this in relastro?
+	// XXX do we need / want to do this in relastro?
 	assignMcal (&image[nimage], (double *) NULL, -1);
 	image[nimage].dMcal = NAN;
