Index: /trunk/Ohana/src/addstar/include/ukirt_uhs.h
===================================================================
--- /trunk/Ohana/src/addstar/include/ukirt_uhs.h	(revision 42130)
+++ /trunk/Ohana/src/addstar/include/ukirt_uhs.h	(revision 42131)
@@ -3,4 +3,5 @@
 
 # define NSTARS_MAX 10000000
+//# define NSTARS_MAX 5000
 // # define NSTARS_MAX 10
 
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c	(revision 42130)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c	(revision 42131)
@@ -467,12 +467,14 @@
 	NELEM += 1000;
 
-	REALLOCATE (sourceID,     uint64_t, NELEM);
+	REALLOCATE (sourceID,     uint64_t, NELEM);  
 	REALLOCATE (frameSetID,   uint64_t, NELEM);
 	REALLOCATE (ra,           double,   NELEM);
 	REALLOCATE (dec,          double,   NELEM);
+	REALLOCATE (epoch,        double,   NELEM);
 	REALLOCATE (priOrSec,     uint64_t, NELEM);
 	REALLOCATE (mergedClass,  int,      NELEM);
 	REALLOCATE (pStar,        double,   NELEM);
 	REALLOCATE (pGalaxy,      double,   NELEM);
+
 	REALLOCATE (zHallMag,     double,   NELEM);
 	REALLOCATE (zHallMagErr,  double,   NELEM);
@@ -485,4 +487,5 @@
 	REALLOCATE (zppErrBits,   int,      NELEM);
 	REALLOCATE (zSeqNum,      int,      NELEM);
+
 	REALLOCATE (yHallMag,     double,   NELEM);
 	REALLOCATE (yHallMagErr,  double,   NELEM);
@@ -495,4 +498,5 @@
 	REALLOCATE (yppErrBits,   int,      NELEM);
 	REALLOCATE (ySeqNum,      int,      NELEM);
+
 	REALLOCATE (jHallMag,     double,   NELEM);
 	REALLOCATE (jHallMagErr,  double,   NELEM);
@@ -505,4 +509,5 @@
 	REALLOCATE (jppErrBits,   int,      NELEM);
 	REALLOCATE (jSeqNum,      int,      NELEM);
+
 	REALLOCATE (hHallMag,     double,   NELEM);
 	REALLOCATE (hHallMagErr,  double,   NELEM);
@@ -515,4 +520,5 @@
 	REALLOCATE (hppErrBits,   int,      NELEM);
 	REALLOCATE (hSeqNum,      int,      NELEM);
+
 	REALLOCATE (k1HallMag,     double,   NELEM);
 	REALLOCATE (k1HallMagErr,  double,   NELEM);
@@ -525,4 +531,5 @@
 	REALLOCATE (k1ppErrBits,   int,      NELEM);
 	REALLOCATE (k1SeqNum,      int,      NELEM);
+
 	REALLOCATE (k2HallMag,     double,   NELEM);
 	REALLOCATE (k2HallMagErr,  double,   NELEM);
@@ -541,4 +548,5 @@
     }
   }
+  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
 
   // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
@@ -715,5 +723,5 @@
     Nstars ++;
 
-    if (NSTARS >= Nstars) {
+    if (Nstars >= NSTARS) {
       NSTARS += 10000;
       REALLOCATE (stars, UKIRT_Stars, NSTARS);
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c	(revision 42130)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c	(revision 42131)
@@ -388,12 +388,14 @@
 	NELEM += 1000;
 
-	REALLOCATE (sourceID,     uint64_t, NELEM);
+	REALLOCATE (sourceID,     uint64_t, NELEM);    
 	REALLOCATE (frameSetID,   uint64_t, NELEM);
 	REALLOCATE (ra,           double,   NELEM);
 	REALLOCATE (dec,          double,   NELEM);
+	REALLOCATE (epoch,        double,   NELEM);
 	REALLOCATE (priOrSec,     uint64_t, NELEM);
 	REALLOCATE (mergedClass,  int,      NELEM);
 	REALLOCATE (pStar,        double,   NELEM);
 	REALLOCATE (pGalaxy,      double,   NELEM);
+
 	REALLOCATE (jAperMag1,     double,   NELEM);
 	REALLOCATE (jAperMag1Err,  double,   NELEM);
@@ -406,4 +408,5 @@
 	REALLOCATE (jppErrBits,   int,      NELEM);
 	REALLOCATE (jSeqNum,      int,      NELEM);
+
 	REALLOCATE (hAperMag1,     double,   NELEM);
 	REALLOCATE (hAperMag1Err,  double,   NELEM);
@@ -416,4 +419,5 @@
 	REALLOCATE (hppErrBits,   int,      NELEM);
 	REALLOCATE (hSeqNum,      int,      NELEM);
+
 	REALLOCATE (k1AperMag1,     double,   NELEM);
 	REALLOCATE (k1AperMag1Err,  double,   NELEM);
@@ -426,4 +430,5 @@
 	REALLOCATE (k1ppErrBits,   int,      NELEM);
 	REALLOCATE (k1SeqNum,      int,      NELEM);
+
 	REALLOCATE (k2AperMag1,     double,   NELEM);
 	REALLOCATE (k2AperMag1Err,  double,   NELEM);
@@ -436,4 +441,5 @@
 	REALLOCATE (k2ppErrBits,   int,      NELEM);
 	REALLOCATE (k2SeqNum,      int,      NELEM);
+
 	REALLOCATE (h2AperMag1,     double,   NELEM);
 	REALLOCATE (h2AperMag1Err,  double,   NELEM);
@@ -452,4 +458,5 @@
     }
   }
+  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
 
   // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
@@ -606,5 +613,5 @@
     Nstars ++;
 
-    if (NSTARS >= Nstars) {
+    if (Nstars >= NSTARS) {
       NSTARS += 10000;
       REALLOCATE (stars, UKIRT_Stars, NSTARS);
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c	(revision 42130)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c	(revision 42131)
@@ -234,4 +234,5 @@
     }
   }
+  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
 
   // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
@@ -307,5 +308,5 @@
     Nstars ++;
 
-    if (NSTARS >= Nstars) {
+    if (Nstars >= NSTARS) {
       NSTARS += 10000;
       REALLOCATE (stars, UKIRT_Stars, NSTARS);
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c	(revision 42130)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c	(revision 42131)
@@ -415,12 +415,14 @@
 	NELEM += 1000;
 
-	REALLOCATE (sourceID,     uint64_t, NELEM);
+	REALLOCATE (sourceID,     uint64_t, NELEM);    
 	REALLOCATE (frameSetID,   uint64_t, NELEM);
 	REALLOCATE (ra,           double,   NELEM);
 	REALLOCATE (dec,          double,   NELEM);
+	REALLOCATE (epoch,        double,   NELEM);
 	REALLOCATE (priOrSec,     uint64_t, NELEM);
 	REALLOCATE (mergedClass,  int,      NELEM);
 	REALLOCATE (pStar,        double,   NELEM);
 	REALLOCATE (pGalaxy,      double,   NELEM);
+
 	REALLOCATE (yHallMag,     double,   NELEM);
 	REALLOCATE (yHallMagErr,  double,   NELEM);
@@ -433,4 +435,5 @@
 	REALLOCATE (yppErrBits,   int,      NELEM);
 	REALLOCATE (ySeqNum,      int,      NELEM);
+
 	REALLOCATE (j1HallMag,     double,   NELEM);
 	REALLOCATE (j1HallMagErr,  double,   NELEM);
@@ -443,4 +446,5 @@
 	REALLOCATE (j1ppErrBits,   int,      NELEM);
 	REALLOCATE (j1SeqNum,      int,      NELEM);
+
 	REALLOCATE (j2HallMag,     double,   NELEM);
 	REALLOCATE (j2HallMagErr,  double,   NELEM);
@@ -453,4 +457,5 @@
 	REALLOCATE (j2ppErrBits,   int,      NELEM);
 	REALLOCATE (j2SeqNum,      int,      NELEM);
+
 	REALLOCATE (hHallMag,     double,   NELEM);
 	REALLOCATE (hHallMagErr,  double,   NELEM);
@@ -463,4 +468,5 @@
 	REALLOCATE (hppErrBits,   int,      NELEM);
 	REALLOCATE (hSeqNum,      int,      NELEM);
+
 	REALLOCATE (kHallMag,     double,   NELEM);
 	REALLOCATE (kHallMagErr,  double,   NELEM);
@@ -479,4 +485,5 @@
     }
   }
+  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
 
   // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
@@ -633,5 +640,5 @@
     Nstars ++;
 
-    if (NSTARS >= Nstars) {
+    if (Nstars >= NSTARS) {
       NSTARS += 10000;
       REALLOCATE (stars, UKIRT_Stars, NSTARS);
