diff --git a/Changes b/Changes
index 83ccfa9..7a20529 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 0.55.6 2016-06-08
         - [bugfix] distance with key "t" uses default foundry (diewald)
 	- [cleanup] Renamed fromJson() to fromKoral() (diewald)
+	- [cleanup] Removed deprecated methods in Krill:
+	  setSpanQuery(), getRequest() (diewald)
 
 0.55.5 2016-05-02
 	- [performance] Changed to a dynamic window for sorting in FocusSpans (margaretha)
diff --git a/src/main/java/de/ids_mannheim/korap/Krill.java b/src/main/java/de/ids_mannheim/korap/Krill.java
index 964c10c..0531c63 100644
--- a/src/main/java/de/ids_mannheim/korap/Krill.java
+++ b/src/main/java/de/ids_mannheim/korap/Krill.java
@@ -330,55 +330,4 @@
     public SpanQuery getSpanQuery () {
         return this.spanQuery;
     };
-
-
-    /**
-     * Set the SpanQuery by means of a {@link SpanQueryWrapper} object
-     * (i.e. the internal correspandence to KoralQuery's query
-     * object).
-     * 
-     * <strong>Warning</strong>: SpanQueries may be lazy deserialized
-     * in future versions of Krill, rendering this API obsolete.
-     * 
-     * @param query
-     *            The {@link SpanQueryWrapper} to unwrap
-     *            the {@link SpanQuery} object.
-     * @return The {@link Krill} object for chaining.
-     */
-    @Deprecated
-    public Krill setSpanQuery (SpanQueryWrapper sqwi) {
-        try {
-            this.spanQuery = sqwi.toQuery();
-        }
-        catch (QueryException q) {
-            this.addError(q.getErrorCode(), q.getMessage());
-        };
-        return this;
-    };
-
-
-    /**
-     * Set the {@link SpanQuery} object
-     * (i.e. the internal correspandence to KoralQuery's query
-     * object).
-     * 
-     * <strong>Warning</strong>: SpanQueries may be lazy deserialized
-     * in future versions of Krill, rendering this API obsolete.
-     * 
-     * @param query
-     *            The {@link SpanQuery} object.
-     * @return The {@link Krill} object for chaining.
-     */
-    @Deprecated
-    public Krill setSpanQuery (SpanQuery sq) {
-        this.spanQuery = sq;
-        return this;
-    };
-
-
-    // Requests are out - queries will be mirrored completely
-    @Deprecated
-    public JsonNode getRequest () {
-        return this.request;
-    };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/KrillQuery.java b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
index d12e473..fb7ae74 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
@@ -137,6 +137,17 @@
 
 
     /**
+     * The index field associated with
+     * the token stream.
+     */
+    public String getField () {
+        if (field == null)
+            return "tokens";
+        return this.field;
+    };
+
+
+    /**
      * <p>Deserialize JSON-LD query to a {@link SpanQueryWrapper}
      * object.</p>
      * 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
index bff6608..62f239a 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
@@ -8,6 +8,7 @@
 import org.junit.runners.JUnit4;
 
 import de.ids_mannheim.korap.Krill;
+import de.ids_mannheim.korap.query.wrap.SpanQueryWrapper;
 import de.ids_mannheim.korap.KrillIndex;
 import de.ids_mannheim.korap.query.QueryBuilder;
 import de.ids_mannheim.korap.response.Result;
@@ -39,45 +40,44 @@
         ki.commit();
 
         QueryBuilder kq = new QueryBuilder("base");
-        SpanQuery sq = kq.re("s:af*e").toQuery();
-        assertEquals("SpanMultiTermQueryWrapper(base:/s:af*e/)", sq.toString());
+        SpanQueryWrapper sqw = kq.re("s:af*e");
+        assertEquals("SpanMultiTermQueryWrapper(base:/s:af*e/)", sqw.toQuery().toString());
 
-        Krill ks = new Krill(sq);
-        ks.getMeta().getContext().left.setToken(true).setLength(1);
-        ks.getMeta().getContext().right.setToken(true).setLength(1);
-
+        Krill ks = _newKrill(sqw);
+       
         Result kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
         assertEquals("affe [afffe] baum ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:baum.*")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:baum.*"));
+        kr = ki.search(ks);
+
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... afffe [baum] baumgarten ...", kr.getMatch(0)
-                .getSnippetBrackets());
+                     .getSnippetBrackets());
         assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(1)
-                .getSnippetBrackets());
+                     .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re(
-                "s:.....?garten").toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:.....?garten"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(0)
-                .getSnippetBrackets());
+                     .getSnippetBrackets());
         assertEquals("... baumgarten [steingarten] franz ...", kr.getMatch(1)
-                .getSnippetBrackets());
+                     .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:ha.s")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:ha.s"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... franz [hans] haus ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... hans [haus] efeu ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:.*ff.*")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:.*ff.*"));
+        kr = ki.search(ks);
         assertEquals((long) 3, kr.getTotalResults());
         assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
         assertEquals("affe [afffe] baum ...", kr.getMatch(1)
@@ -85,7 +85,6 @@
         assertEquals("... efeu [effe]", kr.getMatch(2).getSnippetBrackets());
     };
 
-
     @Test
     public void indexWildcard () throws Exception {
         KrillIndex ki = new KrillIndex();
@@ -110,12 +109,10 @@
         ki.commit();
 
         QueryBuilder kq = new QueryBuilder("base");
-        SpanQuery sq = kq.wc("s:af*e").toQuery();
-        assertEquals("SpanMultiTermQueryWrapper(base:s:af*e)", sq.toString());
+        SpanQueryWrapper sq = kq.wc("s:af*e");
+        assertEquals("SpanMultiTermQueryWrapper(base:s:af*e)", sq.toQuery().toString());
 
-        Krill ks = new Krill(sq);
-        ks.getMeta().getContext().left.setToken(true).setLength(1);
-        ks.getMeta().getContext().right.setToken(true).setLength(1);
+        Krill ks = _newKrill(sq);
 
         Result kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
@@ -123,36 +120,37 @@
         assertEquals("affe [afffe] baum ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").wc("s:baum.*")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").wc("s:baum.*"));
+        kr = ki.search(ks);
+
         assertEquals((long) 0, kr.getTotalResults());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").wc("s:baum*")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").wc("s:baum*"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... afffe [baum] baumgarten ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").wc("s:*garten")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").wc("s:*garten"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... baumgarten [steingarten] franz ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").wc("s:ha?s")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").wc("s:ha?s"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... franz [hans] haus ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... hans [haus] efeu ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").wc("s:?ff?")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").wc("s:?ff?"));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
         assertEquals("... efeu [effe]", kr.getMatch(1).getSnippetBrackets());
@@ -183,56 +181,57 @@
         ki.commit();
 
         QueryBuilder kq = new QueryBuilder("base");
-        SpanQuery sq = kq.re("s:Af*e", true).toQuery();
-        assertEquals("SpanMultiTermQueryWrapper(base:/i:af*e/)", sq.toString());
+        SpanQueryWrapper sqw = kq.re("s:Af*e", true);
+        assertEquals("SpanMultiTermQueryWrapper(base:/i:af*e/)", sqw.toQuery().toString());
 
-        Krill ks = new Krill(sq);
-        ks.getMeta().getContext().left.setToken(true).setLength(1);
-        ks.getMeta().getContext().right.setToken(true).setLength(1);
-
+        Krill ks = _newKrill(sqw);
         Result kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
         assertEquals("AfFe [aFfFE] Baum ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:Af.*e")
-                .toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:Af.*e"));
+        kr = ki.search(ks);
         assertEquals((long) 1, kr.getTotalResults());
         assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:baum.*",
-                true).toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:baum.*",
+                                                   true));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... aFfFE [Baum] Baumgarten ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re(
-                "s:.*garten", true).toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re(
+                                                   "s:.*garten", true));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... Baumgarten [SteinGarten] franZ ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re(
-                "s:.*garten", false).toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:.*garten", false));
+        kr = ki.search(ks);
         assertEquals((long) 1, kr.getTotalResults());
         assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(0)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:ha.s",
-                true).toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:ha.s",
+                                                   true));
+        kr = ki.search(ks);
         assertEquals((long) 2, kr.getTotalResults());
         assertEquals("... franZ [HaNs] Haus ...", kr.getMatch(0)
                 .getSnippetBrackets());
         assertEquals("... HaNs [Haus] Efeu ...", kr.getMatch(1)
                 .getSnippetBrackets());
 
-        kr = ki.search(ks.setSpanQuery(new QueryBuilder("base").re("s:.*f*e",
-                true).toQuery()));
+        ks = _newKrill(new QueryBuilder("base").re("s:.*f*e",
+                                                   true));
+        kr = ki.search(ks);
         assertEquals((long) 3, kr.getTotalResults());
         assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
         assertEquals("AfFe [aFfFE] Baum ...", kr.getMatch(1)
@@ -281,7 +280,6 @@
                 .getSnippetBrackets());
     };
 
-
     @Test
     public void indexRegexWithinRewrite () throws Exception {
         KrillIndex ki = new KrillIndex();
@@ -321,4 +319,11 @@
         assertEquals("[affe afffe] baum ...", kr.getMatch(0)
                 .getSnippetBrackets());
     };
+
+    private Krill _newKrill (SpanQueryWrapper query) {
+        Krill ks = new Krill(query);
+        ks.getMeta().getContext().left.setToken(true).setLength(1);
+        ks.getMeta().getContext().right.setToken(true).setLength(1);
+        return ks;
+    };
 };
