diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index d95919f..12a6a76 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -1072,7 +1072,7 @@
 	return this.search(collection, ks);
     };
 
-
+    // To be honest - the collection is already part of the KorapSearch! 
     public KorapResult search (KorapCollection collection, KorapSearch ks) {
 	if (DEBUG)
 	    log.trace("Start search");
@@ -1279,7 +1279,7 @@
 				   KorapSearch ks,
 				   MatchCollector mc) {
 	if (DEBUG)
-	    log.trace("Start collecting matches");
+	    log.trace("Start collecting");
 
 	// Init term context
 	this.termContexts = new HashMap<Term, TermContext>();
@@ -1294,7 +1294,7 @@
 	// See: http://www.ibm.com/developerworks/java/library/j-benchmark1/index.html
 	long t1 = System.nanoTime();
 
-	// Only load ID
+	// Only load UID
 	HashSet<String> fieldsToLoadLocal = new HashSet<>();
 	fieldsToLoadLocal.add("UID");
 
@@ -1359,23 +1359,17 @@
 		    }
 		    else {
 			matchcount++;
-			// atomicMatches.add(match);
 		    };
 		};
 
-		/*
-		if (!atomicMatches.isEmpty()) {
-		    // Add matches to the collector
-		    mc.add(uniqueDocID, atomicMatches);
-		    atomicMatches.clear();
-		};
-		*/
+		// Add count to collector
 		if (matchcount > 0) {
 		    mc.add(uniqueDocID, matchcount);
 		    matchcount = 0;
 		};
 	    };
 
+	    // Benchmark the collector
 	    mc.setBenchmark(t1, System.nanoTime());
 	}
 	catch (IOException e) {
diff --git a/src/main/java/de/ids_mannheim/korap/KorapResult.java b/src/main/java/de/ids_mannheim/korap/KorapResult.java
index 852710c..7300d24 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapResult.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapResult.java
@@ -119,6 +119,7 @@
         return this.itemsPerPage;
     }
 
+    /*
 
     public String getError() {
         return this.error;
@@ -128,6 +129,8 @@
         this.error = msg;
     }
 
+    */
+
     public String getWarning() {
         return this.warning;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/server/KorapResponse.java b/src/main/java/de/ids_mannheim/korap/server/KorapResponse.java
index ccca3bd..d1edf4b 100644
--- a/src/main/java/de/ids_mannheim/korap/server/KorapResponse.java
+++ b/src/main/java/de/ids_mannheim/korap/server/KorapResponse.java
@@ -34,7 +34,16 @@
 
     @JsonIgnore
     public KorapResponse setError (int code, String msg) {
-	return this.setErrstr(msg).setErr(code);
+	this.err = code;
+	this.errstr = msg;
+	return this;
+    };
+
+    @JsonIgnore
+    public KorapResponse setError (String msg) {
+	this.err = 699;
+	this.errstr = msg;
+	return this;
     };
 
     public KorapResponse setErrstr (String msg) {
diff --git a/src/main/java/de/ids_mannheim/korap/server/Resource.java b/src/main/java/de/ids_mannheim/korap/server/Resource.java
index 94e72e5..eb0119a 100644
--- a/src/main/java/de/ids_mannheim/korap/server/Resource.java
+++ b/src/main/java/de/ids_mannheim/korap/server/Resource.java
@@ -95,9 +95,8 @@
 	KorapIndex index = KorapNode.getIndex();
 	KorapResponse kresp = new KorapResponse(KorapNode.getName(), index.getVersion());
 
-	// kresp.setErr();
 	if (index == null)
-	    return kresp.setErrstr("Unable to find index").toJSON();
+	    return kresp.setError(601, "Unable to find index").toJSON();
 
 	String ID = "Unknown";
 	int unstaged = 0;
@@ -133,6 +132,9 @@
 	KorapIndex index = KorapNode.getIndex();
 	KorapResponse kresp = new KorapResponse(KorapNode.getName(), index.getVersion());
 
+	if (index == null)
+	    return kresp.setError(601, "Unable to find index").toJSON();
+
 	if (version == null)
 	    version = index.getVersion();
 
@@ -149,8 +151,10 @@
 	return kresp.setMsg("Unstaged data was committed").toJSON();
     };
 
+
+
     /**
-     * Find matches in the lucene index and return them as results.
+     * Find matches in the lucene index based on UIDs and return one match per doc.
      *
      * @param text_id
      */
@@ -187,17 +191,87 @@
 		return ks.run(index).toJSON();
 	    };
 	    KorapResult kr = new KorapResult();
-	    kr.setError("No UUIDs given");
+	    kr.setNode(KorapNode.getName());
+	    kr.setError(610, "No UUIDs given");
 	    return kr.toJSON();
 	};
-	// Response with error message
-        KorapResult kr = new KorapResult();
-        kr.setError("Index not found");
-        return kr.toJSON();
+
+	return new KorapResponse(
+	    KorapNode.getName(),
+	    index.getVersion()
+        ).setError(601, "Unable to find index").toJSON();
     };
 
 
     /**
+     * Collect matches and aggregate the UIDs plus matchcount in the database.
+     *
+     * @param text_id
+     */
+    /*
+    @POST
+    @Path("/collect/{resultID}")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    public String find (String json, @Context UriInfo uri) {
+
+	// Get index
+	KorapIndex index = KorapNode.getIndex();
+
+	// No index found
+	if (index == null)
+  	    return new KorapResponse(
+	        KorapNode.getName(),
+	        index.getVersion()
+            ).setError(601, "Unable to find index").toJSON();
+
+	// Get the database
+	// Create a database based matchcollector
+
+
+	// TODO: Only search in self documents (REPLICATION FTW!)
+
+	MatchCollector result = index.collect(KorapCollection, KorapSearch, MatchCollector);
+
+
+		// Build Collection based on a list of uids
+		List<String> uids = qp.get("uid");
+		KorapCollection kc = new KorapCollection();
+		kc.filterUIDs(uids.toArray(new String[uids.size()]));
+
+		// TODO: RESTRICT COLLECTION TO ONLY RESPECT SELF DOCS (REPLICATION)
+
+		// Override old collection
+		ks.setCollection(kc);
+
+		// Only return the first match per text
+		ks.setItemsPerResource(1);
+
+		return ks.run(index).toJSON();
+	    };
+	    KorapResult kr = new KorapResult();
+	    kr.setNode(KorapNode.getName());
+	    kr.setError(610, "No UUIDs given");
+	    return kr.toJSON();
+	};
+
+	return new KorapResponse(
+	    KorapNode.getName(),
+	    index.getVersion()
+        ).setError(601, "Unable to find index").toJSON();
+    };
+*/
+
+
+
+
+
+    /* These routes are still wip: */
+
+
+
+
+    /**
      * Search the lucene index.
      *
      * @param json JSON-LD string with search and potential meta filters.
@@ -212,13 +286,16 @@
 	KorapIndex index = KorapNode.getIndex();
 
 	// Search index
-        if (index != null)
-            return new KorapSearch(json).run(index).toJSON();
+        if (index != null) {
+            KorapResult kr = new KorapSearch(json).run(index);
+	    kr.setNode(KorapNode.getName());
+	    return kr.toJSON();
+	};
 
-	// Response with error message
-        KorapResult kr = new KorapResult();
-        kr.setError("Index not found");
-        return kr.toJSON();
+	return new KorapResponse(
+	    KorapNode.getName(),
+	    index.getVersion()
+        ).setError(601, "Unable to find index").toJSON();
     };
 
     @GET
@@ -279,6 +356,7 @@
 
 	    // Nothing found
 	    catch (QueryException qe) {
+		// Todo: Make KorapMatch rely on KorapResponse!
                 KorapMatch km = new KorapMatch();
                 km.setError(qe.getMessage());
                 return km.toJSON();
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
index e4dccc4..1623e92 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
@@ -168,7 +168,7 @@
 	KorapResult kr = new KorapSearch("{ query").run(ki);
 
 	assertEquals(0, kr.getTotalResults());
-	assertNotNull(kr.getError());
+	assertNotNull(kr.getErr());
     };
 
 
@@ -529,7 +529,7 @@
 	String json = getString(getClass().getResource("/queries/bsp-bug.jsonld").getFile());
 
 	KorapResult kr = new KorapSearch(json).run(ki);
-	assertEquals(kr.getError(), "Operation needs exactly two operands");
+	assertEquals(kr.getErrstr(), "Operation needs exactly two operands");
     };
 
 
