Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/LoadDataUKIRT.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/LoadDataUKIRT.c	(revision 38168)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/LoadDataUKIRT.c	(revision 38169)
@@ -4,5 +4,5 @@
 // there should only be a single data set (phu + table) in this file
 // each SDSS data set corresponds to 5 images (ugriz)
-int LoadDataSDSS (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages) {
+int LoadDataUKIRT (FILE *f, char *file, Image **images, off_t *nimages, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t NheaderSets) {
 
   off_t Nskip, Nvalid, NVALID;
@@ -12,4 +12,5 @@
   Stars *inStars;
 
+  // create or update image table 
   if (images[0] == NULL) {
     Nvalid = 0;
@@ -17,5 +18,5 @@
     ALLOCATE (images[0], Image, NVALID);
   } else {
-    Nvalid = *nvalid;
+    Nvalid = *nimages;
     NVALID = Nvalid + 4;
     REALLOCATE (images[0], Image, NVALID);
@@ -26,5 +27,5 @@
 
   // validate the number of headers sets == 4
-  for (i = 0; i < 4; i++) {
+  for (i = 0; i < NheaderSets; i++) {
     if (VERBOSE) fprintf (stderr, "reading header for %s (%s)\n", headerSets[i].exthead, headerSets[i].extdata);
 
@@ -42,5 +43,5 @@
 
     free (name);
-    *nvalid = Nvalid;
+    *nimages = Nvalid;
   }    
   return (TRUE);
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/MatchHeaders.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/MatchHeaders.c	(revision 38168)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/MatchHeaders.c	(revision 38169)
@@ -18,4 +18,5 @@
   mode = GetFileMode (headers[0]);
 
+  // mosaic mef can be identified from the PHU
   if (mode == MOSAIC_MEF) {
     headerSets[Nimage].exthead     = strcreate ("PHU");
@@ -26,4 +27,5 @@
   }
 
+  // sdss obj can be identified from the PHU
   if (mode == SDSS_OBJ) {
     // XXX these should have two headers (phu + table)
@@ -40,8 +42,9 @@
 
   // check for ukirt mode
-  if (Nheaders == 5) { 
+  // check if headers[1] is UKIRT_OBJ (and all others)
+  if (Nheaders > 1) { 
     int myMode = GetFileMode (headers[1]);
     if (myMode != UKIRT_OBJ) goto other_modes;
-    for (i = 2; i < 5; i++) {
+    for (i = 2; i < Nheaders; i++) {
       myMode = GetFileMode (headers[i]);
       if (myMode != UKIRT_OBJ) {
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/ReadStarsUKIRT.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/ReadStarsUKIRT.c	(revision 38168)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/ReadStarsUKIRT.c	(revision 38169)
@@ -28,6 +28,4 @@
   CODE = code[0].code; \
   ZP = 0.001*code[0].C; }
-
-// XXX NOTE : as of 2008.02.27, the zero point is still carried internally in millimags
 
 // given a file with the pointer at the start of the table block and the 
