diff --git a/pom.xml b/pom.xml
index b36529a..0db5741 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,7 +169,7 @@
         <dependency>
             <groupId>de.ids_mannheim.korap</groupId>
             <artifactId>Krill</artifactId>
-            <version>0.52</version>
+            <version>0.53</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.xerial</groupId>
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 2cf379a..dd9fdd1 100644
--- a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -50,7 +50,8 @@
             KorAPLogger.ERROR_LOGGER
                     .error("Unable to load index: {}", e.getMessage());
         }
-    }
+    };
+
 
     /**
      * Search in the Lucene index.
@@ -67,6 +68,7 @@
         return kr.toJsonString();
     };
 
+
     /**
      * Search in the Lucene index and return matches as token lists.
      *
@@ -171,54 +173,6 @@
         return km.toJsonString();
     };
 
-    /**
-     * Get statistics on (virtual) collections.
-     *
-     * @param json JSON-LD string with potential meta filters.
-     */
-    @Deprecated
-    public String getStatisticsLegacy (JsonNode json) throws QueryException {
-        qlog.trace(JsonUtils.toJSON(json));
-        System.out.println("THE NODE BEFORE GETTING STATISTICS " + json);
-
-        if (this.index == null) {
-            return "{\"documents\" : -1, error\" : \"No index given\" }";
-        }
-
-        // Create Virtula VCollection from json search
-        KrillCollection kc = new KrillCollection();
-        kc.fromJsonLegacy(json);
-
-        // Set index
-        kc.setIndex(this.index);
-
-        long docs = 0,
-            tokens = 0,
-            sentences = 0,
-            paragraphs = 0;
-
-        // Get numbers from index (currently slow)
-        try {
-            docs = kc.numberOf("documents");
-            tokens = kc.numberOf("tokens");
-            sentences = kc.numberOf("sentences");
-            paragraphs = kc.numberOf("paragraphs");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-
-	/*
-    KorAPLogger.ERROR_LOGGER.error("Unable to retrieve statistics: {}", e.getMessage());
-	*/
-
-        // Build json response
-        StringBuilder sb = new StringBuilder("{");
-        sb.append("\"documents\":").append(docs).append(",\"tokens\":")
-                .append(tokens).append(",\"sentences\":").append(sentences)
-                .append(",\"paragraphs\":").append(paragraphs).append("}");
-        return sb.toString();
-    }
 
     /**
      * Get statistics on (virtual) collections.
@@ -252,12 +206,7 @@
             paragraphs = kc.numberOf("paragraphs");
         } catch (IOException e) {
             e.printStackTrace();
-        }
-
-
-	/*
-    KorAPLogger.ERROR_LOGGER.error("Unable to retrieve statistics: {}", e.getMessage());
-	*/
+        };
 
         // Build json response
         StringBuilder sb = new StringBuilder("{");
@@ -265,48 +214,12 @@
                 .append(tokens).append(",\"sentences\":").append(sentences)
                 .append(",\"paragraphs\":").append(paragraphs).append("}");
         return sb.toString();
-    }
+    };
 
-    /**
-     * Get set relations on field terms of (virtual) collections.
-     *
-     * @param json JSON-LD string with potential meta filters.
-     */
-    @Deprecated
-    public String getTermRelation (String json, String field) {
-        qlog.trace(json);
-
-        if (this.index == null) {
-            return "{\"documents\" : -1, \"error\" : \"No index given\" }";
-        }
-
-        // Create Virtula VCollection from json search
-        KrillCollection kc = new KrillCollection(json);
-
-        // Set index
-        kc.setIndex(this.index);
-        long v = 0L;
-        try {
-            v = kc.numberOf("documents");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            // Get term relations as a json string
-            return kc.getTermRelationJSON(field);
-        } catch (IOException e) {
-            KorAPLogger.ERROR_LOGGER
-                    .error("Unable to retrieve term relations: {}",
-                            e.getMessage());
-            return "{\"documents\" : -1, \"error\" : \"IO error\" }";
-        }
-    }
 
     public String getMatchId (String type, String docid, String tofrom) {
         return new StringBuilder().append("match-").append(type).append("!")
                 .append(type).append("_").append(docid).append("-")
                 .append(tofrom).toString();
-    }
-
-}
+    };
+};
