Index: trunk/psModules/src/astrom/pmAstrometryObjects.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 24025)
+++ trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 24034)
@@ -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);
 }
