Index: trunk/ppTranslate/src/ppMops.c
===================================================================
--- trunk/ppTranslate/src/ppMops.c	(revision 32176)
+++ trunk/ppTranslate/src/ppMops.c	(revision 32406)
@@ -3,4 +3,24 @@
 
 #include "ppMops.h"
+
+void test()
+{
+    psMetadata *md = psMetadataAlloc();
+
+    psVector *vec = psVectorAlloc(42, PS_TYPE_S32);
+
+    psMetadataAddVector(md, PS_LIST_TAIL, "TEST", 0, NULL, vec);
+
+    psFree(vec);
+    psFree(md);
+
+    psLibFinalize();
+
+    fprintf (stderr, "found %d leaks at %s\n", 
+    	psMemCheckLeaks2 (0,
+		NULL, stdout, false, 500), "ppMops");
+
+    exit(0);
+}
 
 /*
@@ -39,4 +59,6 @@
     psLibInit(NULL);
 
+    // test();
+
     ppMopsArguments *args = ppMopsArgumentsParse(argc, argv); // Parsed arguments
     if (!args) {
@@ -45,4 +67,5 @@
     }
 
+
     psArray *detections = ppMopsRead(args); // Detections from each input
     if (!detections) {
@@ -51,19 +74,19 @@
     }
 
-    ppMopsDetections *merged = ppMopsMerge(detections); // Merged detections
-    psFree(detections);
-    if (!merged) {
+    if (!ppMopsPurgeDuplicates(detections)) {
         psErrorStackPrint(stderr, "Unable to merge detections");
         exit(PS_EXIT_SYS_ERROR);
     }
 
-    if (!ppMopsWrite(merged, args)) {
+    if (!ppMopsWrite(detections, args)) {
         psErrorStackPrint(stderr, "Unable to write detections");
         exit(PS_EXIT_SYS_ERROR);
     }
 
-    psFree(merged);
+    for (int i = 0; i < detections->n; i++) {
+        psFree(detections->data[i]);
+    }
+    psFree(detections);
     psFree(args);
-    psFree(detections);
 
     psLibFinalize();
