Index: branches/pap/psModules/src/astrom/pmAstrometryObjects.c
===================================================================
--- branches/pap/psModules/src/astrom/pmAstrometryObjects.c	(revision 23948)
+++ branches/pap/psModules/src/astrom/pmAstrometryObjects.c	(revision 25027)
@@ -83,7 +83,12 @@
 {
     psArray *matches = psArrayAllocEmpty(x1->n);
+    psVector *found1 = psVectorAlloc(x1->n, PS_TYPE_S8);
+    psVector *found2 = psVectorAlloc(x2->n, PS_TYPE_S8);
 
     const double RADIUS_SQR = PS_SQR(RADIUS);
     double dX, dY, dR;
+
+    psVectorInit (found1, 0);
+    psVectorInit (found2, 0);
 
     int jStart;
@@ -100,6 +105,15 @@
         }
 
+	if (found1->data.S8[i]) {
+	    i++;
+	    continue;
+	}
+	if (found2->data.S8[j]) {
+	    j++;
+	    continue;
+	}
+
         jStart = j;
-        while (fabs(dX) < RADIUS && j < x2->n) {
+        while ((fabs(dX) < RADIUS) && (j < x2->n)) {
 
             dX = x1->data.F64[i] - x2->data.F64[j];
@@ -111,4 +125,8 @@
                 continue;
             }
+	    if (found2->data.S8[j]) {
+		j++;
+		continue;
+	    }
 
             // got a match; add to output list
@@ -117,4 +135,7 @@
             psFree (match);
 
+	    found1->data.S8[i] = 1;
+	    found2->data.S8[j] = 1;
+
             j++;
         }
@@ -122,4 +143,7 @@
         i++;
     }
+    psFree (found1);
+    psFree (found2);
+
     return (matches);
 }
@@ -420,4 +444,5 @@
     obj->sky  = psSphereAlloc();
     obj->Mag  = 0;
+    obj->Color= 0;
     obj->dMag = 0;
 
@@ -447,4 +472,5 @@
     *obj->sky  = *old->sky;
     obj->Mag   =  old->Mag;
+    obj->Color =  old->Color;
     obj->dMag  =  old->dMag;
 
