Added check for minimum repetition and formatted codes.

Change-Id: Id19e4d844ddb1cf46d69d68bacb5d07a656de5f3
diff --git a/src/main/java/de/ids_mannheim/korap/Krill.java b/src/main/java/de/ids_mannheim/korap/Krill.java
index 437e1e9..5b40873 100644
--- a/src/main/java/de/ids_mannheim/korap/Krill.java
+++ b/src/main/java/de/ids_mannheim/korap/Krill.java
@@ -222,8 +222,8 @@
 
                 // TODO: Temporary
                 if (collNode.fieldNames().hasNext()) {
-                    this.setCollection(new KrillCollection()
-                            .fromKoral(collNode));
+                    this.setCollection(
+                            new KrillCollection().fromKoral(collNode));
                 };
             }
 
diff --git a/src/main/java/de/ids_mannheim/korap/KrillCollection.java b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
index d49c4d6..38b0a48 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
@@ -200,7 +200,8 @@
                         return this.cb.till(key, dateStr);
                 };
 
-                throw new QueryException(841, "Match relation unknown for type");
+                throw new QueryException(841,
+                        "Match relation unknown for type");
             }
 
             // Filter based on string
@@ -216,23 +217,24 @@
                         return this.cb.term(key, json.get("value").asText())
                                 .not();
 
-                        // This may change - but for now it means the elements are lowercased
+                    // This may change - but for now it means the elements are lowercased
                     case "match:contains":
-                        return this.cb.term(key, json.get("value").asText()
-                                .toLowerCase());
+                        return this.cb.term(key,
+                                json.get("value").asText().toLowerCase());
 
                     case "match:containsnot":
                         return this.cb.term(key,
                                 json.get("value").asText().toLowerCase()).not();
 
-                        // <LEGACY>
+                    // <LEGACY>
                     case "match:excludes":
                         return this.cb.term(key,
                                 json.get("value").asText().toLowerCase()).not();
-                        // </LEGACY>
+                    // </LEGACY>
                 };
 
-                throw new QueryException(841, "Match relation unknown for type");
+                throw new QueryException(841,
+                        "Match relation unknown for type");
             }
 
             // Filter based on regex
@@ -254,7 +256,8 @@
                     return this.cb.re(key, json.get("value").asText()).not();
                 };
 
-                throw new QueryException(841, "Match relation unknown for type");
+                throw new QueryException(841,
+                        "Match relation unknown for type");
             };
 
             throw new QueryException(843, "Document type is not supported");
@@ -320,8 +323,8 @@
 
 
     public KrillCollection extend (CollectionBuilder.Interface extension) {
-        return this.fromBuilder(this.cb.orGroup().with(this.cbi)
-                .with(extension));
+        return this
+                .fromBuilder(this.cb.orGroup().with(this.cbi).with(extension));
     };
 
 
@@ -460,8 +463,8 @@
 
             // Init vector
             DocIdSet docids = filter.getDocIdSet(atomic, null);
-            DocIdSetIterator filterIter = (docids == null) ? null : docids
-                    .iterator();
+            DocIdSetIterator filterIter = (docids == null) ? null
+                    : docids.iterator();
 
             if (filterIter == null) {
                 if (!this.cbi.isNegative())
@@ -485,8 +488,8 @@
         };
 
         // Remove deleted docs
-        return (DocIdSet) BitsFilteredDocIdSet.wrap((DocIdSet) new BitDocIdSet(
-                bitset), acceptDocs);
+        return (DocIdSet) BitsFilteredDocIdSet
+                .wrap((DocIdSet) new BitDocIdSet(bitset), acceptDocs);
     };
 
 
@@ -681,72 +684,72 @@
             throws Exception {
         HashMap<String, Long> map = new HashMap<>(100);
         long docNumber = 0, checkNumber = 0;
-
+    
         try {
             if (kc.getCount() <= 0) {
                 checkNumber = (long) this.reader().numDocs();
             };
-
+    
             for (LeafReaderContext atomic : this.reader().leaves()) {
                 HashMap<String, FixedBitSet> termVector = new HashMap<>(20);
-
+    
                 FixedBitSet docvec = kc.bits(atomic);
                 if (docvec != null) {
                     docNumber += docvec.cardinality();
                 };
-
+    
                 Terms terms = atomic.reader().fields().terms(field);
-
+    
                 if (terms == null) {
                     continue;
                 };
-
+    
                 int docLength = atomic.reader().maxDoc();
                 FixedBitSet bitset = new FixedBitSet(docLength);
-
+    
                 // Iterate over all tokens in this field
                 TermsEnum termsEnum = terms.iterator(null);
-
+    
                 while (termsEnum.next() != null) {
-
+    
                     String termString = termsEnum.term().utf8ToString();
-
+    
                     bitset.clear(0, docLength);
-
+    
                     // Get frequency
                     bitset.or((DocIdSetIterator) termsEnum.docs((Bits) docvec,
                             null));
-
+    
                     long value = 0;
                     if (map.containsKey(termString))
                         value = map.get(termString);
-
+    
                     map.put(termString, value + bitset.cardinality());
-
+    
                     termVector.put(termString, bitset.clone());
                 };
-
+    
                 int keySize = termVector.size();
                 String[] keys = termVector.keySet()
                         .toArray(new String[keySize]);
                 java.util.Arrays.sort(keys);
-
+    
                 if (keySize > maxTermRelations) {
                     throw new Exception("termRelations are limited to "
                             + maxTermRelations + " sets"
                             + " (requested were at least " + keySize + " sets)");
                 };
-
+    
                 for (int i = 0; i < keySize; i++) {
                     for (int j = i + 1; j < keySize; j++) {
                         FixedBitSet comby = termVector.get(keys[i]).clone();
                         comby.and(termVector.get(keys[j]));
-
+    
                         StringBuilder sb = new StringBuilder();
                         sb.append("#__").append(keys[i]).append(":###:")
                                 .append(keys[j]);
                         String combString = sb.toString();
-
+    
                         long cap = (long) comby.cardinality();
                         if (map.containsKey(combString)) {
                             cap += map.get(combString);
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index d978efc..06713b2 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -139,8 +139,7 @@
 
     private byte[] pl = new byte[4];
     private static ByteBuffer bb = ByteBuffer.allocate(4),
-            bbOffset = ByteBuffer.allocate(8),
-            bbTerm = ByteBuffer.allocate(16);
+            bbOffset = ByteBuffer.allocate(8), bbTerm = ByteBuffer.allocate(16);
 
     // Some initializations ...
     {
@@ -161,7 +160,8 @@
                 this.autoCommit = Integer.parseInt(autoCommitStr);
             }
             catch (NumberFormatException e) {
-                log.error("krill.index.commit.auto expected to be a numerical value");
+                log.error(
+                        "krill.index.commit.auto expected to be a numerical value");
             };
         };
     };
@@ -547,8 +547,8 @@
             if (gzip) {
 
                 // Create json field document
-                FieldDocument fd = this.mapper.readValue(new GZIPInputStream(
-                        json), FieldDocument.class);
+                FieldDocument fd = this.mapper.readValue(
+                        new GZIPInputStream(json), FieldDocument.class);
                 return fd;
             };
             return this.mapper.readValue(json, FieldDocument.class);
@@ -579,7 +579,8 @@
      * @return The number of the occurrences.
      * @see KrillCollection#numberOf
      */
-    public long numberOf (KrillCollection collection, String field, String type) {
+    public long numberOf (KrillCollection collection, String field,
+            String type) {
 
         collection.setIndex(this);
         try {
@@ -616,11 +617,11 @@
             };
             return docCount;
         };
-
+        
         // Create search term
         // This may be prefixed by foundries
         Term term = new Term(field, "-:" + type);
-
+        
         long occurrences = 0;
         try {
             // Iterate over all atomic readers and collect occurrences
@@ -629,12 +630,12 @@
                         atomic, term);
             };
         }
-
+        
         // Something went wrong
         catch (Exception e) {
             log.warn(e.getLocalizedMessage());
         };
-
+        
         return occurrences;
         */
     };
@@ -702,9 +703,9 @@
         FixedBitSet os = (FixedBitSet) docvec;
         return os.cardinality();
     };
-
+    
     Term term = new Term(field, "-:" + type);
-
+    
     int occurrences = 0;
     try {
         for (LeafReaderContext atomic : this.reader().leaves()) {
@@ -714,7 +715,7 @@
     catch (IOException e) {
         log.warn(e.getLocalizedMessage());
     };
-
+    
     return occurrences;
     };
     */
@@ -783,8 +784,8 @@
         // Rewrite parse ID
         uid = new Integer(Integer.parseInt(uid)).toString();
 
-        Filter filter = (Filter) new QueryWrapperFilter(new TermQuery(new Term(
-                "UID", uid)));
+        Filter filter = (Filter) new QueryWrapperFilter(
+                new TermQuery(new Term("UID", uid)));
 
         try {
 
@@ -792,8 +793,8 @@
             for (LeafReaderContext atomic : this.reader().leaves()) {
 
                 // Retrieve the single document of interest
-                DocIdSet filterSet = filter.getDocIdSet(atomic, atomic.reader()
-                        .getLiveDocs());
+                DocIdSet filterSet = filter.getDocIdSet(atomic,
+                        atomic.reader().getLiveDocs());
 
                 // Create a bitset for the correct document
                 Bits bitset = filterSet.bits();
@@ -858,7 +859,7 @@
                 false,    // includeSpans
                 true,     // includeHighlights
                 false     // extendToSentence
-                );
+        );
     };
 
 
@@ -923,8 +924,7 @@
         // Create a filter based on the corpusID and the docID
         BooleanQuery bool = new BooleanQuery();
         if (match.getTextSigle() != null) {
-            bool.add(
-                    new TermQuery(new Term("textSigle", match.getTextSigle())),
+            bool.add(new TermQuery(new Term("textSigle", match.getTextSigle())),
                     BooleanClause.Occur.MUST);
         }
 
@@ -993,7 +993,8 @@
 
                         // Filter out bad layers
                         for (i = layer.size() - 1; i >= 0; i--) {
-                            if (!harmlessLayer.matcher(layer.get(i)).matches()) {
+                            if (!harmlessLayer.matcher(layer.get(i))
+                                    .matches()) {
                                 throw new QueryException(
                                         "Invalid layer requested: "
                                                 + layer.get(i));
@@ -1040,8 +1041,8 @@
             for (LeafReaderContext atomic : this.reader().leaves()) {
 
                 // Retrieve the single document of interest
-                DocIdSet filterSet = filter.getDocIdSet(atomic, atomic.reader()
-                        .getLiveDocs());
+                DocIdSet filterSet = filter.getDocIdSet(atomic,
+                        atomic.reader().getLiveDocs());
 
 
                 // Create a bitset for the correct document
@@ -1074,8 +1075,8 @@
                 Terms docTerms = atomic.reader().getTermVector(localDocID,
                         field);
 
-                HashSet<String> fields = (HashSet<String>) new Krill()
-                        .getMeta().getFields().clone();
+                HashSet<String> fields = (HashSet<String>) new Krill().getMeta()
+                        .getFields().clone();
 
                 fields.add(field);
 
@@ -1108,7 +1109,8 @@
                     if (DEBUG)
                         log.trace("Extend to sentence element '{}'", element);
 
-                    if (spanContext[0] >= 0 && spanContext[0] < spanContext[1]) {
+                    if (spanContext[0] >= 0
+                            && spanContext[0] < spanContext[1]) {
                         match.setStartPos(spanContext[0]);
                         match.setEndPos(spanContext[1]);
                         match.startMore = false;
@@ -1210,7 +1212,8 @@
             };
         }
         catch (IOException e) {
-            match.addError(600, "Unable to read index", e.getLocalizedMessage());
+            match.addError(600, "Unable to read index",
+                    e.getLocalizedMessage());
             log.warn(e.getLocalizedMessage());
         };
 
@@ -1327,9 +1330,10 @@
             // Revise!
             // Based on core/src/java/org/apache/lucene/search/IndexSearcher.java
             // and highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java
-            for (Query rewrittenQuery = query.rewrite(this.reader()); !rewrittenQuery
-                    .equals(query); rewrittenQuery = query.rewrite(this
-                    .reader())) {
+            for (Query rewrittenQuery = query
+                    .rewrite(this.reader()); !rewrittenQuery
+                            .equals(query); rewrittenQuery = query
+                                    .rewrite(this.reader())) {
                 query = (SpanQuery) rewrittenQuery;
             };
 
@@ -1376,7 +1380,8 @@
                     if (itemsPerResource > 0) {
 
                         // IDS are identical
-                        if (localDocID == oldLocalDocID || oldLocalDocID == -1) {
+                        if (localDocID == oldLocalDocID
+                                || oldLocalDocID == -1) {
                             if (itemsPerResourceCounter++ >= itemsPerResource) {
                                 if (spans.skipTo(localDocID + 1) != true) {
                                     break;
@@ -1402,8 +1407,9 @@
                     docID = atomic.docBase + localDocID;
 
                     // Do not load all of this, in case the doc is the same!
-                    final Document doc = (fields != null) ? lreader.document(
-                            localDocID, fields) : lreader.document(localDocID);
+                    final Document doc = (fields != null)
+                            ? lreader.document(localDocID, fields)
+                            : lreader.document(localDocID);
 
                     // Create new Match
                     final Match match = new Match(pto, localDocID,
@@ -1461,7 +1467,8 @@
                             break;
 
                         // IDS are identical
-                        if (localDocID == oldLocalDocID || oldLocalDocID == -1) {
+                        if (localDocID == oldLocalDocID
+                                || oldLocalDocID == -1) {
                             if (localDocID == -1)
                                 break;
 
@@ -1549,8 +1556,9 @@
         try {
 
             // Rewrite query (for regex and wildcard queries)
-            for (Query rewrittenQuery = query.rewrite(this.reader()); rewrittenQuery != (Query) query; rewrittenQuery = query
-                    .rewrite(this.reader())) {
+            for (Query rewrittenQuery = query.rewrite(
+                    this.reader()); rewrittenQuery != (Query) query; rewrittenQuery = query
+                            .rewrite(this.reader())) {
                 query = (SpanQuery) rewrittenQuery;
             };
 
@@ -1596,8 +1604,8 @@
                         };
 
                         // Read document id from index
-                        uniqueDocIDString = lreader
-                                .document(localDocID, fields).get("UID");
+                        uniqueDocIDString = lreader.document(localDocID, fields)
+                                .get("UID");
 
                         if (uniqueDocIDString != null)
                             uniqueDocID = Integer.parseInt(uniqueDocIDString);
diff --git a/src/main/java/de/ids_mannheim/korap/KrillMeta.java b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
index c6bb0a4..a6aaade 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillMeta.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
@@ -43,9 +43,9 @@
 
         // Lift following fields per default
         // These fields are chosen for <legacy /> reasons
-        for (String field : new String[] { "ID", "UID", "textSigle",
-                "corpusID", "author", "title", "subTitle", "textClass",
-                "pubPlace", "pubDate",
+        for (String field : new String[] { "ID", "UID", "textSigle", "corpusID",
+                "author", "title", "subTitle", "textClass", "pubPlace",
+                "pubDate",
                 // "foundries",
                 // "tokenization",
                 // New:
diff --git a/src/main/java/de/ids_mannheim/korap/KrillQuery.java b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
index 19fd398..45f1dda 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
@@ -156,11 +156,11 @@
      * SpanQueryWrapper sqw = kq.fromKoral(
      * "{\"@type\" : \"koral:token\","+
      * "\"wrap\" : {" +
-     * "\"@type\" :   \"koral:term\"," +
+     * "\"@type\" : \"koral:term\"," +
      * "\"foundry\" : \"opennlp\"," +
-     * "\"key\" :     \"tree\"," +
-     * "\"layer\" :   \"orth\"," +
-     * "\"match\" :   \"match:eq\""+
+     * "\"key\" : \"tree\"," +
+     * "\"layer\" : \"orth\"," +
+     * "\"match\" : \"match:eq\""+
      * "}}"
      * );
      * </pre></blockquote>
@@ -231,10 +231,10 @@
                 return this._groupFromJson(json);
 
             case "koral:reference":
-                if (json.has("operation")
-                        && !json.get("operation").asText()
-                                .equals("operation:focus"))
-                    throw new QueryException(712, "Unknown reference operation");
+                if (json.has("operation") && !json.get("operation").asText()
+                        .equals("operation:focus"))
+                    throw new QueryException(712,
+                            "Unknown reference operation");
 
                 if (!json.has("operands")) {
                     throw new QueryException(766,
@@ -293,14 +293,13 @@
                     SpanSubspanQueryWrapper ssqw = new SpanSubspanQueryWrapper(
                             sqw, startOffset, length);
                     return ssqw;
-                }
-                ;
+                };
 
                 if (DEBUG)
                     log.trace("Wrap class reference {}", number);
 
-                return new SpanFocusQueryWrapper(this._fromKoral(operands
-                        .get(0)), number);
+                return new SpanFocusQueryWrapper(
+                        this._fromKoral(operands.get(0)), number);
 
             case "koral:token":
 
@@ -446,10 +445,10 @@
                 // Deprecated in favor of operation:junction
             case "operation:or":
                 return this._operationJunctionFromJson(operands);
-                /*
-                  case "operation:submatch": // Deprecated in favor of koral:reference
-                  return this._operationSubmatchFromJson(json, operands);
-                */
+            /*
+              case "operation:submatch": // Deprecated in favor of koral:reference
+              return this._operationSubmatchFromJson(json, operands);
+            */
             case "operation:disjunction":
                 return this._operationJunctionFromJson(operands);
         };
@@ -469,11 +468,9 @@
         for (int i = 0; i < operands.size(); i++) {
             childNode = operands.get(i);
             if (childNode.has("@type")
-                    && childNode.get("@type").asText()
-                            .equals("koral:reference")
-                    && childNode.has("operation")
-                    && childNode.get("operation").asText()
-                            .equals("operation:focus")
+                    && childNode.get("@type").asText().equals("koral:reference")
+                    && childNode.has("operation") && childNode.get("operation")
+                            .asText().equals("operation:focus")
                     && !childNode.has("operands")) {
 
                 if (childNode.has("classRef")) {
@@ -963,7 +960,8 @@
         // inOrder was set to false without a distance constraint
         if (!sseqqw.isInOrder() && !sseqqw.hasConstraints()) {
             if (DEBUG)
-                log.trace("Add distance constraint - for the normal inorder case");
+                log.trace(
+                        "Add distance constraint - for the normal inorder case");
 
             sseqqw.withConstraint(1, 1, "w");
         };
@@ -973,7 +971,8 @@
 
 
     // Deserialize koral:token
-    private SpanQueryWrapper _segFromJson (JsonNode json) throws QueryException {
+    private SpanQueryWrapper _segFromJson (JsonNode json)
+            throws QueryException {
 
         if (!json.has("@type"))
             throw new QueryException(701,
@@ -1006,9 +1005,9 @@
                 //
                 //            case "match:eq":
                 return this._termFromJson(json);
-                //            };
-                //
-                //            throw new QueryException(741, "Match relation unknown");
+            //            };
+            //
+            //            throw new QueryException(741, "Match relation unknown");
 
             case "koral:termGroup":
 
@@ -1043,8 +1042,7 @@
                                 throw new QueryException(744,
                                         "Operand not supported in term group");
                             };
-                        }
-                        ;
+                        };
                         return ssegqw;
 
                     case "relation:or":
@@ -1053,11 +1051,9 @@
                                 this.field);
                         for (JsonNode operand : operands) {
                             ssaq.or(this._segFromJson(operand));
-                        }
-                        ;
+                        };
                         return ssaq;
-                }
-                ;
+                };
         };
         throw new QueryException(745, "Token type is not supported");
     };
@@ -1193,23 +1189,23 @@
 
             // Branch on type
             switch (json.get("type").asText()) {
-			case "type:regex": {
+                case "type:regex": {
 
-				// The regex can be rewritten to an any token
-				if (value.toString().matches("^[si]:\\.[\\+\\*]\\??$")) {
-					return new SpanRepetitionQueryWrapper();
-				};
-				return qb.seg(qb.re(value.toString(), isCaseInsensitive));
-			}
-			case "type:wildcard":
-				return qb.seq(qb.wc(value.toString(), isCaseInsensitive));
+                    // The regex can be rewritten to an any token
+                    if (value.toString().matches("^[si]:\\.[\\+\\*]\\??$")) {
+                        return new SpanRepetitionQueryWrapper();
+                    };
+                    return qb.seg(qb.re(value.toString(), isCaseInsensitive));
+                }
+                case "type:wildcard":
+                    return qb.seq(qb.wc(value.toString(), isCaseInsensitive));
 
-			case "type:string":
-				break;
+                case "type:string":
+                    break;
 
-			default:
-				this.addWarning(746,
-								"Term type is not supported - treated as a string");
+                default:
+                    this.addWarning(746,
+                            "Term type is not supported - treated as a string");
             };
         };
 
@@ -1248,8 +1244,8 @@
                 // "Arbitraty elements with attributes are currently not supported.");
             }
             else {
-                SpanQueryWrapper elementWithIdWrapper = this.builder().tag(
-                        value.toString());
+                SpanQueryWrapper elementWithIdWrapper = this.builder()
+                        .tag(value.toString());
                 if (elementWithIdWrapper == null) {
                     return null;
                 }
@@ -1366,9 +1362,8 @@
 
                 // TODO: Here do not refer to 'tokens'!!!
                 // EM: what should it be? property?
-                return new SpanAttributeQueryWrapper(
-                        new SpanSimpleQueryWrapper("tokens", "@root",
-                                Boolean.valueOf(rootValue)));
+                return new SpanAttributeQueryWrapper(new SpanSimpleQueryWrapper(
+                        "tokens", "@root", Boolean.valueOf(rootValue)));
             }
         }
         return null;
diff --git a/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java b/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
index 2143664..475b5be 100644
--- a/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
@@ -104,8 +104,8 @@
 
     @Override
     public String toString () {
-        StringBuilder buffer = new StringBuilder(this.isOptional ? "OrGroup("
-                : "AndGroup(");
+        StringBuilder buffer = new StringBuilder(
+                this.isOptional ? "OrGroup(" : "AndGroup(");
         boolean first = true;
         for (final GroupFilterOperand operand : this.operands) {
             if (first)
@@ -168,8 +168,8 @@
                             log.debug("- Filter to allow all documents");
 
                         bitset.set(0, maxDoc);
-                        return BitsFilteredDocIdSet.wrap(
-                                new BitDocIdSet(bitset), acceptDocs);
+                        return BitsFilteredDocIdSet
+                                .wrap(new BitDocIdSet(bitset), acceptDocs);
                     };
 
                     // There is no possible match
diff --git a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
index 350d852..d3ade8b 100644
--- a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
@@ -58,7 +58,8 @@
             if (till == 0 || till == KrillDate.END)
                 return null;
 
-            return new CollectionBuilder.Range(field, KrillDate.BEGINNING, till);
+            return new CollectionBuilder.Range(field, KrillDate.BEGINNING,
+                    till);
         }
         catch (NumberFormatException e) {
             log.warn("Parameter of till(date) is invalid");
@@ -99,7 +100,8 @@
             return new CollectionBuilder.Range(field, begin, end);
         };
 
-        return new CollectionBuilder.Range(field, dateDF.floor(), dateDF.ceil());
+        return new CollectionBuilder.Range(field, dateDF.floor(),
+                dateDF.ceil());
     };
 
 
@@ -153,8 +155,8 @@
                                 this.field, this.term)));
 
             // Simple term
-            return new TermsFilter(new org.apache.lucene.index.Term(this.field,
-                    this.term));
+            return new TermsFilter(
+                    new org.apache.lucene.index.Term(this.field, this.term));
         };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
index b293a47..d367382 100644
--- a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
@@ -44,7 +44,7 @@
     public int internalDocID, localDocID, UID;
 
     private KrillDate pubDate,
-    // newly added
+            // newly added
             creationDate;
 
     private HashMap<String, String> fieldMap;
@@ -52,28 +52,17 @@
     private String
 
     // No longer supported
-            ID,
-            corpusID,
-            field,
-            layerInfo,
-            tokenization,
+    ID, corpusID, field, layerInfo, tokenization,
 
             // Still supported
-            foundries,
-            textClass,
-            pubPlace,
+            foundries, textClass, pubPlace,
 
             // Newly added for the corpus/doc/text distinction of DeReKo
-            textSigle, docSigle, corpusSigle, title, subTitle, author,
-            editor,
-            docTitle, docSubTitle, docAuthor, docEditor,
-            corpusTitle,
-            corpusSubTitle, corpusAuthor, corpusEditor, textType,
-            textTypeArt,
-            textTypeRef, textColumn, textDomain,
-            fileEditionStatement,
-            biblEditionStatement, publisher, reference, language,
-            license,
+            textSigle, docSigle, corpusSigle, title, subTitle, author, editor,
+            docTitle, docSubTitle, docAuthor, docEditor, corpusTitle,
+            corpusSubTitle, corpusAuthor, corpusEditor, textType, textTypeArt,
+            textTypeRef, textColumn, textDomain, fileEditionStatement,
+            biblEditionStatement, publisher, reference, language, license,
             pages, keywords,
 
             // Meta information regarding annotations
diff --git a/src/main/java/de/ids_mannheim/korap/index/Indexer.java b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
index c5da39b..b5dfd20 100644
--- a/src/main/java/de/ids_mannheim/korap/index/Indexer.java
+++ b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
@@ -71,7 +71,8 @@
 
                 // Add file to the index
                 try {
-                    if (this.index.addDoc(new FileInputStream(found), true) == null) {
+                    if (this.index.addDoc(new FileInputStream(found),
+                            true) == null) {
                         System.out.println("fail.");
                         continue;
                     };
@@ -121,8 +122,8 @@
             String jar = new File(Indexer.class.getProtectionDomain()
                     .getCodeSource().getLocation().getPath()).getName();
 
-            System.out
-                    .println("Add documents from a directory to the Krill index.");
+            System.out.println(
+                    "Add documents from a directory to the Krill index.");
             System.out.println("Usage: java -jar " + jar
                     + " [--config propfile] [directories]*");
             System.out.println();
diff --git a/src/main/java/de/ids_mannheim/korap/index/MultiTerm.java b/src/main/java/de/ids_mannheim/korap/index/MultiTerm.java
index b009e7b..e4eb624 100644
--- a/src/main/java/de/ids_mannheim/korap/index/MultiTerm.java
+++ b/src/main/java/de/ids_mannheim/korap/index/MultiTerm.java
@@ -158,7 +158,8 @@
      * @return The {@link MultiTerm} object for chaining.
      */
     public MultiTerm setPayload (short pl) {
-        this.payload = new BytesRef(ByteBuffer.allocate(2).putShort(pl).array());
+        this.payload = new BytesRef(
+                ByteBuffer.allocate(2).putShort(pl).array());
         return this;
     };
 
@@ -321,8 +322,8 @@
                 sb.append(this.payload.utf8ToString());
             }
             catch (AssertionError e) {
-                sb.append("<?>").append(
-                        this.payload.toString().replace(' ', ','));
+                sb.append("<?>")
+                        .append(this.payload.toString().replace(' ', ','));
             };
         };
 
@@ -364,8 +365,8 @@
                 sb.append(this.payload.utf8ToString());
             }
             catch (AssertionError e) {
-                sb.append("<?>").append(
-                        this.payload.toString().replace(' ', ','));
+                sb.append("<?>")
+                        .append(this.payload.toString().replace(' ', ','));
             };
         };
         return sb.toString();
@@ -398,8 +399,8 @@
 
                         // Resize the bytebuffer
                         if ((bb.capacity() - l) < 8) {
-                            bb = ByteBuffer.allocate(bb.capacity() + 8).put(
-                                    bb.array());
+                            bb = ByteBuffer.allocate(bb.capacity() + 8)
+                                    .put(bb.array());
                             bb.position(l);
                         };
 
@@ -479,7 +480,7 @@
 
     // Unescape the term
     private String _unescape (String term) {
-        return term.replace("\\\\", "\\").replace("\\#", "#")
-                .replace("\\$", "$");
+        return term.replace("\\\\", "\\").replace("\\#", "#").replace("\\$",
+                "$");
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java b/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
index f02b074..50e39aa 100644
--- a/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
+++ b/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
@@ -153,7 +153,8 @@
      *            A surface string of a {@link MultiTerm}.
      * @return The {@link MultiTermTokenStream} object for chaining.
      */
-    public MultiTermTokenStream addMultiTermToken (char prefix, String surface) {
+    public MultiTermTokenStream addMultiTermToken (char prefix,
+            String surface) {
         return this.addMultiTermToken(new MultiTermToken(prefix, surface));
     };
 
diff --git a/src/main/java/de/ids_mannheim/korap/index/PositionsToOffset.java b/src/main/java/de/ids_mannheim/korap/index/PositionsToOffset.java
index bd84972..c471c51 100644
--- a/src/main/java/de/ids_mannheim/korap/index/PositionsToOffset.java
+++ b/src/main/java/de/ids_mannheim/korap/index/PositionsToOffset.java
@@ -161,8 +161,8 @@
 
 
     public void addOffset (int docID, int pos, int startOffset, int endOffset) {
-        offsets.put(new PositionsToOffsetArray(docID, pos), new Integer[] {
-                startOffset, endOffset });
+        offsets.put(new PositionsToOffsetArray(docID, pos),
+                new Integer[] { startOffset, endOffset });
     };
 
 
@@ -233,8 +233,7 @@
                             }
 
                             else {
-                                log.error(
-                                        "Doc {} has no offsets stored for {}",
+                                log.error("Doc {} has no offsets stored for {}",
                                         docID, term.toString());
                             };
                         };
diff --git a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
index dc7403a..3f05ea8 100644
--- a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
+++ b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
@@ -68,8 +68,7 @@
                     this.type = "relTarget";
                     tterm = tterm.substring(2);
                     ttype = 3;
-                }
-                ;
+                };
                 break;
 
             case '>':
diff --git a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
index 7a87bdd..279131f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
@@ -53,7 +53,7 @@
  * </ol>
  * 
  * @author margaretha
- * */
+ */
 
 public class DistanceConstraint {
     private int minDistance, maxDistance;
diff --git a/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java b/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java
index e0c3dd6..ba90a77 100644
--- a/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java
@@ -60,9 +60,8 @@
     public static final int PRECEDES = 1, PRECEDES_DIRECTLY = 1 << 1,
             OVERLAPS_LEFT = 1 << 2, ALIGNS_LEFT = 1 << 3, STARTS_WITH = 1 << 4,
             MATCHES = 1 << 5, IS_WITHIN = 1 << 6, IS_AROUND = 1 << 7,
-            ENDS_WITH = 1 << 8, ALIGNS_RIGHT = 1 << 9,
-            OVERLAPS_RIGHT = 1 << 10, SUCCEEDS_DIRECTLY = 1 << 11,
-            SUCCEEDS = 1 << 12, ALL = 1024 * 8 - 1;
+            ENDS_WITH = 1 << 8, ALIGNS_RIGHT = 1 << 9, OVERLAPS_RIGHT = 1 << 10,
+            SUCCEEDS_DIRECTLY = 1 << 11, SUCCEEDS = 1 << 12, ALL = 1024 * 8 - 1;
 
 
     private static final Map<String, Integer> FRAME;
@@ -113,7 +112,8 @@
          * a.end < b.end && a.start == b.start
          */
         FRAME_t.put("alignsLeft", ALIGNS_LEFT);
-        NEXT_B_t.add(PRECEDES | PRECEDES_DIRECTLY | OVERLAPS_LEFT | ALIGNS_LEFT);
+        NEXT_B_t.add(
+                PRECEDES | PRECEDES_DIRECTLY | OVERLAPS_LEFT | ALIGNS_LEFT);
 
         /*
          * A starts with B
@@ -338,6 +338,7 @@
     // Todo: create nextB arraymatrix by adding all combinations of constellation precomputed
     // NEXTB[SUCCEEDS_DIRECTLY | SUCCEEDS] = NEXTB[SUCEEDS_DIRECTLY] | NEXTB[SUCCEEDS];
 
+
     // NextB
     // Integer.numberOfTrailingZeros();
     private static int _next_b (int constellation) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/QueryBuilder.java b/src/main/java/de/ids_mannheim/korap/query/QueryBuilder.java
index 96e4eb5..f065737 100644
--- a/src/main/java/de/ids_mannheim/korap/query/QueryBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/query/QueryBuilder.java
@@ -132,7 +132,8 @@
      */
     public SpanRegexQueryWrapper re (String re, int flags,
             boolean caseinsensitive) {
-        return new SpanRegexQueryWrapper(this.field, re, flags, caseinsensitive);
+        return new SpanRegexQueryWrapper(this.field, re, flags,
+                caseinsensitive);
     };
 
 
@@ -257,7 +258,7 @@
         return ssq;
     };
 
-	
+
     /**
      * Create an empty query segment.
      * 
@@ -312,7 +313,8 @@
      *            [] An array of segment defining terms.
      */
     public SpanSequenceQueryWrapper seq (SpanQueryWrapper ... terms) {
-        SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper(this.field);
+        SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper(
+                this.field);
         for (SpanQueryWrapper t : terms)
             sssq.append(t);
         return sssq;
@@ -431,7 +433,8 @@
     };
 
 
-    public SpanFocusQueryWrapper focus (short number, SpanQueryWrapper element) {
+    public SpanFocusQueryWrapper focus (short number,
+            SpanQueryWrapper element) {
         return new SpanFocusQueryWrapper(element, number);
     };
 
@@ -448,8 +451,8 @@
     };
 
 
-    public SpanRepetitionQueryWrapper repeat (SpanQueryWrapper element,
-            int min, int max) {
+    public SpanRepetitionQueryWrapper repeat (SpanQueryWrapper element, int min,
+            int max) {
         return new SpanRepetitionQueryWrapper(element, min, max);
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/query/SimpleSpanQuery.java b/src/main/java/de/ids_mannheim/korap/query/SimpleSpanQuery.java
index 7e428a4..919022e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SimpleSpanQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SimpleSpanQuery.java
@@ -67,7 +67,7 @@
  * @see SpanQuery
  * 
  * @author margaretha
- * */
+ */
 public abstract class SimpleSpanQuery extends SpanQuery implements Cloneable {
 
     protected SpanQuery firstClause = null, secondClause = null;
@@ -91,7 +91,7 @@
      *            <code>true</code> if payloads are to be collected,
      *            otherwise
      *            <code>false</code>.
-     * */
+     */
     public SimpleSpanQuery (SpanQuery firstClause, boolean collectPayloads) {
         if (firstClause == null) {
             throw new IllegalArgumentException(
@@ -117,7 +117,7 @@
      *            <code>true</code> if payloads are to be collected,
      *            otherwise
      *            <code>false</code>.
-     * */
+     */
     public SimpleSpanQuery (SpanQuery firstClause, SpanQuery secondClause,
                             boolean collectPayloads) {
         this(firstClause, collectPayloads);
@@ -144,7 +144,7 @@
      *            <code>true</code> if payloads are to be collected,
      *            otherwise
      *            <code>false</code>.
-     * */
+     */
     public SimpleSpanQuery (SpanQuery firstClause,
                             List<SpanQuery> secondClauses,
                             boolean collectPayloads) {
@@ -209,7 +209,7 @@
 
     /**
      * {@inheritDoc}
-     * */
+     */
     @Override
     public String getField () {
         return field;
@@ -339,8 +339,8 @@
             throws IOException {
 
         for (int i = 0; i < spanQueries.size(); i++) {
-            final SpanQuery query = (SpanQuery) spanQueries.get(i).rewrite(
-                    reader);
+            final SpanQuery query = (SpanQuery) spanQueries.get(i)
+                    .rewrite(reader);
             if (!query.equals(spanQueries.get(i))) {
                 if (clone == null)
                     clone = clone();
@@ -381,7 +381,7 @@
 
     /**
      * {@inheritDoc}
-     * */
+     */
     // Used in rewriting query
     @Override
     public boolean equals (Object o) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanAttributeQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanAttributeQuery.java
index 265d2de..0ae6922 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanAttributeQuery.java
@@ -42,7 +42,7 @@
  * </pre>
  * 
  * @author margaretha
- * */
+ */
 public class SpanAttributeQuery extends SimpleSpanQuery {
 
     boolean negation;
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
index da53af7..88c4de1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
@@ -106,14 +106,14 @@
  * 
  * 
  * @author margaretha
- * */
+ */
 public class SpanDistanceQuery extends SimpleSpanQuery {
 
     private boolean exclusion;
     private boolean isOrdered;
     private int minDistance, maxDistance;
     private SpanElementQuery elementQuery; // element distance unit (sentence or
-                                           // paragraph)
+                                          // paragraph)
     private String distanceUnit;
     private String spanName;
     private DistanceConstraint constraint;
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanExpansionQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanExpansionQuery.java
index d7130e1..2d6c29f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanExpansionQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanExpansionQuery.java
@@ -97,7 +97,7 @@
  * together with a class number.
  * 
  * @author margaretha
- * */
+ */
 public class SpanExpansionQuery extends SimpleSpanQuery {
 
     private int min, max; // min, max expansion position
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanMultipleDistanceQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanMultipleDistanceQuery.java
index 51ba29b..ce65df6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanMultipleDistanceQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanMultipleDistanceQuery.java
@@ -73,7 +73,7 @@
  * </ul>
  * 
  * @author margaretha
- * */
+ */
 public class SpanMultipleDistanceQuery extends SimpleSpanQuery {
 
     private List<DistanceConstraint> constraints;
@@ -106,7 +106,8 @@
     public SpanMultipleDistanceQuery (SpanQuery firstClause,
                                       SpanQuery secondClause,
                                       List<DistanceConstraint> constraints,
-                                      boolean isOrdered, boolean collectPayloads) {
+                                      boolean isOrdered,
+                                      boolean collectPayloads) {
         super(firstClause, secondClause, collectPayloads);
         this.constraints = constraints;
         this.isOrdered = isOrdered;
@@ -165,7 +166,7 @@
      * meeting all the constraints.
      * 
      * @return only the span matches meeting all the constraints.
-     * */
+     */
     @Override
     public Spans getSpans (LeafReaderContext context, Bits acceptDocs,
             Map<Term, TermContext> termContexts) throws IOException {
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
index 151abf4..311a5fc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
@@ -23,44 +23,47 @@
                                    SpanQuery operand, boolean collectPayloads) {
 
         checkVariables(relation, operand);
-        SpanFocusQuery sq = new SpanFocusQuery(new SpanSegmentQuery(
-                relationQuery, operandQuery, true),
+        SpanFocusQuery sq = new SpanFocusQuery(
+                new SpanSegmentQuery(relationQuery, operandQuery, true),
                 relation.getTempClassNumbers());
         sq.setMatchTemporaryClass(true);
         sq.setRemoveTemporaryClasses(true);
         sq.setSorted(false); // which operand to focus might be
-                             // different from that to match
+                            // different from that to match
 
         this.setFirstClause(sq);
         this.collectPayloads = collectPayloads;
     }
 
 
-    public SpanRelationMatchQuery (SpanRelationQuery relation,
-                                   SpanQuery source, SpanQuery target,
-                                   boolean collectPayloads) {
+    public SpanRelationMatchQuery (SpanRelationQuery relation, SpanQuery source,
+                                   SpanQuery target, boolean collectPayloads) {
 
         checkVariables(relation, source, target);
         SpanFocusQuery sq = null;
         SpanFocusQuery sq2 = null;
         // match source and then target
         if (relationQuery.getDirection() == 0) {
-            sq = new SpanFocusQuery(new SpanSegmentQuery(relationQuery,
-                    operandQuery, true), relation.getTempTargetNum());
+            sq = new SpanFocusQuery(
+                    new SpanSegmentQuery(relationQuery, operandQuery, true),
+                    relation.getTempTargetNum());
             sq.setSorted(false);
             sq.setMatchTemporaryClass(true);
 
-            sq2 = new SpanFocusQuery(new SpanSegmentQuery(operand2Query, sq,
-                    true), relation.getTempClassNumbers());
+            sq2 = new SpanFocusQuery(
+                    new SpanSegmentQuery(operand2Query, sq, true),
+                    relation.getTempClassNumbers());
         }
         // match target and then source
         else {
-            sq = new SpanFocusQuery(new SpanSegmentQuery(relationQuery,
-                    operandQuery, true), relation.getTempSourceNum());
+            sq = new SpanFocusQuery(
+                    new SpanSegmentQuery(relationQuery, operandQuery, true),
+                    relation.getTempSourceNum());
             sq.setMatchTemporaryClass(true);
 
-            sq2 = new SpanFocusQuery(new SpanSegmentQuery(sq, operand2Query,
-                    true), relation.getTempClassNumbers());
+            sq2 = new SpanFocusQuery(
+                    new SpanSegmentQuery(sq, operand2Query, true),
+                    relation.getTempClassNumbers());
         }
 
         sq2.setMatchTemporaryClass(true);
@@ -128,8 +131,8 @@
     public Spans getSpans (LeafReaderContext context, Bits acceptDocs,
             Map<Term, TermContext> termContexts) throws IOException {
 
-        return new FocusSpans((SpanFocusQuery) firstClause, context,
-                acceptDocs, termContexts);
+        return new FocusSpans((SpanFocusQuery) firstClause, context, acceptDocs,
+                termContexts);
     }
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
index a2f565c..094e457 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
@@ -54,7 +54,7 @@
  * </ol>
  * 
  * @author margaretha
- * */
+ */
 public class SpanRelationQuery extends SimpleSpanQuery {
 
     private int direction = 0; // >
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRepetitionQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRepetitionQuery.java
index 92c6c94..c169e4b 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRepetitionQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRepetitionQuery.java
@@ -47,7 +47,7 @@
  * </pre>
  * 
  * @author margaretha
- * */
+ */
 public class SpanRepetitionQuery extends SimpleSpanQuery {
 
     private int min, max;
@@ -72,6 +72,10 @@
     public SpanRepetitionQuery (SpanQuery sq, int min, int max,
                                 boolean collectPayloads) {
         super(sq, collectPayloads);
+        if (min < 1) {
+            throw new IllegalArgumentException(
+                    "Minimum repetition must not lower than 1.");
+        }
         this.min = min;
         this.max = max;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java
index 508c7ca..9e36c40 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java
@@ -26,7 +26,7 @@
  * </pre>
  * 
  * @author margaretha
- * */
+ */
 public class SpanSegmentQuery extends SimpleSpanQuery {
 
     private boolean isRelation;
@@ -72,7 +72,8 @@
     @Override
     public Spans getSpans (LeafReaderContext context, Bits acceptDocs,
             Map<Term, TermContext> termContexts) throws IOException {
-        return (Spans) new SegmentSpans(this, context, acceptDocs, termContexts);
+        return (Spans) new SegmentSpans(this, context, acceptDocs,
+                termContexts);
     }
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java
index 9ec9632..5d31352 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java
@@ -36,7 +36,7 @@
  * two tokens of all sentences.
  * 
  * @author margaretha
- * */
+ */
 public class SpanSubspanQuery extends SimpleSpanQuery {
 
     private int startOffset, length;
@@ -60,8 +60,8 @@
      *            otherwise
      *            <code>false</code>.
      */
-    public SpanSubspanQuery (SpanQuery firstClause, int startOffset,
-                             int length, boolean collectPayloads) {
+    public SpanSubspanQuery (SpanQuery firstClause, int startOffset, int length,
+                             boolean collectPayloads) {
         super(firstClause, collectPayloads);
         this.startOffset = startOffset;
         this.length = length;
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
index 324d560..51ae8d1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
@@ -30,7 +30,7 @@
  * the Term "tt:p/NN".
  * 
  * @author margaretha
- * */
+ */
 public class SpanTermWithIdQuery extends SimpleSpanQuery {
 
     /**
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
index fae7aa0..915ac3a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
@@ -199,8 +199,8 @@
                     termContexts);
         }
 
-        SimpleSpans spans = (SimpleSpans) this.getFirstClause().getSpans(
-                context, acceptDocs, termContexts);
+        SimpleSpans spans = (SimpleSpans) this.getFirstClause()
+                .getSpans(context, acceptDocs, termContexts);
         return new SpansWithAttribute(this, spans, context, acceptDocs,
                 termContexts);
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
index 4958bea..ab0576f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
@@ -43,7 +43,7 @@
  * "any element having a specific attribute".
  * 
  * @author margaretha
- * */
+ */
 public class AttributeSpans extends SimpleSpans {
 
     private List<CandidateAttributeSpan> candidateList;
@@ -243,9 +243,9 @@
      * The
      * attributes with smaller spanIds come first on the list.
      * 
-     * */
-    class CandidateAttributeSpan extends CandidateSpan implements
-            Comparable<CandidateSpan> {
+     */
+    class CandidateAttributeSpan extends CandidateSpan
+            implements Comparable<CandidateSpan> {
 
         /**
          * Construct a CandidateAttributeSpan based on the given span,
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
index b132dc7..83e8ba4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
@@ -15,14 +15,14 @@
  * matching.
  * 
  * @author margaretha
- * */
+ */
 public class CandidateSpan implements Comparable<CandidateSpan>, Cloneable {
     protected int doc, start, end;
     private long cost;
     private Collection<byte[]> payloads;
     private int position;
     private CandidateSpan childSpan; // used for example for multiple distance
-                                     // with unordered constraint
+                                    // with unordered constraint
     protected short spanId;
     protected boolean hasSpanId;
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
index 71e8e42..406247f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
@@ -56,8 +56,8 @@
     private boolean isClassOperationValid () throws IOException {
         setBitsets();
 
-        int cardinality = Math
-                .max(bitset1.cardinality(), bitset2.cardinality());
+        int cardinality = Math.max(bitset1.cardinality(),
+                bitset2.cardinality());
 
         bitset1.and(bitset2);
         // System.out.println("cardinality:" + cardinality);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
index 47a6998..42e59a1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
@@ -56,7 +56,8 @@
      */
     public ClassSpans (SpanQuery operand, LeafReaderContext context,
                        Bits acceptDocs, Map<Term, TermContext> termContexts,
-                       byte number) throws IOException {
+                       byte number)
+            throws IOException {
         spans = operand.getSpans(context, acceptDocs, termContexts);
 
         // The number of the class
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
index f6cd732..b456035 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
@@ -17,7 +17,7 @@
  * distance.
  * 
  * @author margaretha
- * */
+ */
 public class DistanceExclusionSpans extends DistanceSpans {
 
     private int minDistance, maxDistance;
@@ -105,7 +105,7 @@
      * @return distance the difference between the positions of a
      *         firstspan and
      *         a secondspan.
-     * */
+     */
     private int calculateActualDistance () {
         // right secondSpan
         if (firstSpans.end() <= secondSpans.start())
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
index 7bc9136..286f91c 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
@@ -29,7 +29,7 @@
  * @see MultipleDistanceSpans
  * 
  * @author margaretha
- * */
+ */
 public abstract class DistanceSpans extends SimpleSpans {
 
     protected CandidateSpan matchFirstSpan, matchSecondSpan;
@@ -88,7 +88,7 @@
      * 
      * @return <code>true</code> if a span match is available,
      *         <code>false</code> otherwise.
-     * */
+     */
     protected abstract boolean advance () throws IOException;
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
index 78c0e76..1c5ebdc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
@@ -30,7 +30,7 @@
  * Note: The element distance unit does not overlap to each other.
  * 
  * @author margaretha
- * */
+ */
 public class ElementDistanceExclusionSpans extends DistanceSpans {
 
     private Spans elements;
@@ -154,8 +154,8 @@
 
         if (candidateList.isEmpty()) {
             if (isFirstSpanInElement()) {
-                setMatchProperties(new CandidateSpan(firstSpans,
-                        elementPosition));
+                setMatchProperties(
+                        new CandidateSpan(firstSpans, elementPosition));
                 hasMoreSpans = firstSpans.next();
                 return true;
             }
@@ -273,16 +273,16 @@
             if (hasMoreSpans && firstSpans.start() < secondSpans.start()
                     && firstSpans.doc() == currentDocNum) {
                 if (advanceElementTo(firstSpans)) {
-                    targetList.add(new CandidateSpan(firstSpans,
-                            elementPosition));
+                    targetList.add(
+                            new CandidateSpan(firstSpans, elementPosition));
                 }
                 hasMoreSpans = firstSpans.next();
                 continue;
             }
             // collects only second spans occurring inside an element
             if (advanceElementTo(secondSpans)) {
-                candidateList.add(new CandidateSpan(secondSpans,
-                        elementPosition));
+                candidateList
+                        .add(new CandidateSpan(secondSpans, elementPosition));
             }
             hasMoreSecondSpans = secondSpans.next();
         }
@@ -300,8 +300,8 @@
         while (hasMoreSecondSpans && secondSpans.doc() == firstSpans.doc()
                 && secondSpans.start() < firstSpans.end()) {
             if (advanceElementTo(secondSpans)) {
-                candidateList.add(new CandidateSpan(secondSpans,
-                        elementPosition));
+                candidateList
+                        .add(new CandidateSpan(secondSpans, elementPosition));
                 filterCandidateList(elementPosition);
             }
             hasMoreSecondSpans = secondSpans.next();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
index 5f3ded5..dd53ac5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
@@ -24,7 +24,7 @@
  * Note: elements cannot overlap with each other.
  * 
  * @author margaretha
- * */
+ */
 public class ElementDistanceSpans extends OrderedDistanceSpans {
 
     private Spans elements;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
index 4d64921..d747149 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
@@ -37,7 +37,7 @@
  * grouping them altogether.
  * 
  * @author margaretha
- * */
+ */
 public class ExpandedExclusionSpans extends SimpleSpans {
 
     private int min, max;
@@ -68,10 +68,9 @@
         super(spanExpansionQuery, context, acceptDocs, termContexts);
 
         if (spanExpansionQuery.getSecondClause() == null) {
-            throw new IllegalArgumentException(
-                    "The SpanExpansionQuery "
-                            + "is not valid. The spanquery to exclude (notClause) cannot "
-                            + "be null.");
+            throw new IllegalArgumentException("The SpanExpansionQuery "
+                    + "is not valid. The spanquery to exclude (notClause) cannot "
+                    + "be null.");
         }
 
         /*
@@ -265,8 +264,8 @@
                     end = firstSpans.end();
                     //System.out.println(start+","+end);
                     cs = new CandidateSpan(start, end, firstSpans.doc(),
-                            firstSpans.cost(), createPayloads(start,
-                                    firstSpans.start()));
+                            firstSpans.cost(),
+                            createPayloads(start, firstSpans.start()));
                     candidateSpans.add(cs);
                 }
                 counter--;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
index b31abb6..129ef82 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
@@ -27,7 +27,7 @@
  * grouping them altogether.
  * 
  * @author margaretha
- * */
+ */
 public class ExpandedSpans extends SimpleSpans {
 
     private int min, max;
@@ -117,8 +117,8 @@
             while (counter >= min) {
                 start = Math.max(0, firstSpans.start() - counter);
                 cs = new CandidateSpan(start, firstSpans.end(),
-                        firstSpans.doc(), firstSpans.cost(), createPayloads(
-                                start, firstSpans.start()));
+                        firstSpans.doc(), firstSpans.cost(),
+                        createPayloads(start, firstSpans.start()));
 
                 candidateSpans.add(cs);
                 counter--;
@@ -130,8 +130,8 @@
                 // TODO: How do I know if the end is already too far (over the end of the doc)? 
                 end = firstSpans.end() + counter;
                 cs = new CandidateSpan(firstSpans.start(), end,
-                        firstSpans.doc(), firstSpans.cost(), createPayloads(
-                                firstSpans.end(), end));
+                        firstSpans.doc(), firstSpans.cost(),
+                        createPayloads(firstSpans.end(), end));
                 candidateSpans.add(cs);
                 counter++;
             }
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
index e566637..84e5da9 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
@@ -108,9 +108,8 @@
         while (hasMoreSpans || candidates.size() > 0) {
             if (isSorted) {
 
-                if (firstSpans.isPayloadAvailable()
-                        && updateSpanPositions(cs = new CandidateSpan(
-                                firstSpans))) {
+                if (firstSpans.isPayloadAvailable() && updateSpanPositions(
+                        cs = new CandidateSpan(firstSpans))) {
                     setMatch(cs);
                     hasMoreSpans = firstSpans.next();
                     return true;
@@ -137,8 +136,8 @@
         while (hasMoreSpans && candidates.size() < windowSize
                 && firstSpans.doc() == currentDoc) {
 
-            if (firstSpans.isPayloadAvailable()
-                    && updateSpanPositions(cs = new CandidateSpan(firstSpans))) {
+            if (firstSpans.isPayloadAvailable() && updateSpanPositions(
+                    cs = new CandidateSpan(firstSpans))) {
                 if (cs.getDoc() == prevDoc && cs.getStart() < prevStart) {
                     log.warn("Span (" + cs.getStart() + ", " + cs.getEnd()
                             + ") is out of order and skipped.");
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
index f1b7973..ce117ea 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
@@ -31,7 +31,7 @@
  * </ol>
  * 
  * @author margaretha
- * */
+ */
 public class MultipleDistanceSpans extends DistanceSpans {
 
     private DistanceSpans x, y;
@@ -85,7 +85,7 @@
 
     /**
      * Finds the next match.
-     * */
+     */
     protected boolean advance () throws IOException {
         while (hasMoreSpans && ensureSameDoc(x, y)) {
             if (findMatch()) {
@@ -159,7 +159,8 @@
             }
         }
         else if (xf.getStart() == yf.getStart() && xf.getEnd() == yf.getEnd()
-                && xs.getStart() == ys.getStart() && xs.getEnd() == ys.getEnd()) {
+                && xs.getStart() == ys.getStart()
+                && xs.getEnd() == ys.getEnd()) {
             setMatchProperties(x, false);
             return true;
         }
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/NextSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/NextSpans.java
index 3db12a7..75dd930 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/NextSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/NextSpans.java
@@ -77,7 +77,8 @@
      */
     private boolean advance () throws IOException {
 
-        while (hasMoreSpans || !matchList.isEmpty() || !candidateList.isEmpty()) {
+        while (hasMoreSpans || !matchList.isEmpty()
+                || !candidateList.isEmpty()) {
             if (!matchList.isEmpty()) {
                 matchDocNumber = firstSpans.doc();
                 matchStartPosition = firstSpans.start();
@@ -197,8 +198,8 @@
                 payloads.addAll(cs.getPayloads());
         }
 
-        matchList.add(new CandidateSpan(start, cs.getEnd(),
-                candidateListDocNum, cost, payloads));
+        matchList.add(new CandidateSpan(start, cs.getEnd(), candidateListDocNum,
+                cost, payloads));
     }
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/NonPartialOverlappingSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/NonPartialOverlappingSpans.java
index 07d1526..4464d90 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/NonPartialOverlappingSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/NonPartialOverlappingSpans.java
@@ -19,7 +19,7 @@
  * their positions and do not have a partial overlap.
  * 
  * @author margaretha
- * */
+ */
 public abstract class NonPartialOverlappingSpans extends SimpleSpans {
 
     private Logger log = LoggerFactory
@@ -97,7 +97,7 @@
      * @return 0 iff match is found, -1 to advance the firstspan, 1 to
      *         advance
      *         the secondspan
-     * */
+     */
     protected abstract int findMatch ();
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/OrderedDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/OrderedDistanceSpans.java
index 64507ab..52dc507 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/OrderedDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/OrderedDistanceSpans.java
@@ -16,7 +16,7 @@
  * Base class for calculating a distance between two ordered spans.
  * 
  * @author margaretha
- * */
+ */
 public abstract class OrderedDistanceSpans extends DistanceSpans {
 
     protected boolean hasMoreFirstSpans;
@@ -57,7 +57,7 @@
 
     /**
      * Finds a span match in the candidate list.
-     * */
+     */
     @Override
     protected boolean advance () throws IOException {
         while (hasMoreSpans && candidateListIndex < candidateList.size()) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
index 59d678e..ca467fc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
@@ -48,7 +48,7 @@
  * relation target is always 2 regardless of the relation direction.
  * 
  * @author margaretha
- * */
+ */
 public class RelationSpans extends RelationBaseSpans {
 
     private int currentDoc, currentPosition;
@@ -61,8 +61,8 @@
     private byte sourceClass, targetClass;
 
     public static enum PayloadTypeIdentifier {
-        TERM_TO_TERM(32), TERM_TO_ELEMENT(33), ELEMENT_TO_TERM(34), ELEMENT_TO_ELEMENT(
-                35);
+        TERM_TO_TERM(32), TERM_TO_ELEMENT(33), ELEMENT_TO_TERM(
+                34), ELEMENT_TO_ELEMENT(35);
 
         private byte value;
 
@@ -260,8 +260,8 @@
         if (direction == 0) {
             payload.add(createClassPayload(cs.getLeftStart(), cs.getLeftEnd(),
                     tempSourceNum, false));
-            payload.add(createClassPayload(cs.getRightStart(),
-                    cs.getRightEnd(), tempTargetNum, false));
+            payload.add(createClassPayload(cs.getRightStart(), cs.getRightEnd(),
+                    tempTargetNum, false));
 
             if (sourceClass > 0) {
                 payload.add(createClassPayload(cs.getLeftStart(),
@@ -274,8 +274,8 @@
 
         }
         else {
-            payload.add(createClassPayload(cs.getRightStart(),
-                    cs.getRightEnd(), tempSourceNum, false));
+            payload.add(createClassPayload(cs.getRightStart(), cs.getRightEnd(),
+                    tempSourceNum, false));
             payload.add(createClassPayload(cs.getLeftStart(), cs.getLeftEnd(),
                     tempTargetNum, false));
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
index 843ccd8..cedd25a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
@@ -24,7 +24,7 @@
  * repetition depends on the min and max parameters.
  * 
  * @author margaretha
- * */
+ */
 public class RepetitionSpans extends SimpleSpans {
 
     // Logger
@@ -179,8 +179,8 @@
                 if (i == 1) {
                     try {
                         matchSpan = startSpan.clone();
-                        matchSpan.setPayloads(computeMatchPayload(
-                                adjacentSpans, 0, endIndex - 1));
+                        matchSpan.setPayloads(computeMatchPayload(adjacentSpans,
+                                0, endIndex - 1));
                         matchList.add(matchSpan);
                     }
                     catch (CloneNotSupportedException e) {
@@ -250,8 +250,8 @@
      *            the end index
      * @return
      */
-    private long computeMatchCost (List<CandidateSpan> adjacentSpans,
-            int start, int end) {
+    private long computeMatchCost (List<CandidateSpan> adjacentSpans, int start,
+            int end) {
         long matchCost = 0;
         for (int i = start; i <= end; i++) {
             matchCost += adjacentSpans.get(i).getCost();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
index d6b5d12..96b699f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
@@ -17,7 +17,7 @@
  * have exactly the same start and end positions.
  * 
  * @author margaretha
- * */
+ */
 public class SegmentSpans extends SimpleSpans {
 
     private boolean isRelation;
@@ -90,7 +90,7 @@
      * firstspan and
      * secondspan are identical.
      * 
-     * */
+     */
     protected int findMatch () {
         if (firstSpans.start() == secondSpans.start()
                 && firstSpans.end() == secondSpans.end()) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
index 6918e38..7917eb5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
@@ -20,7 +20,7 @@
  * and basic methods.
  * 
  * @author margaretha
- * */
+ */
 public abstract class SimpleSpans extends Spans {
     private SimpleSpanQuery query;
     protected boolean isStartEnumeration;
@@ -51,7 +51,8 @@
 
     public SimpleSpans (SimpleSpanQuery simpleSpanQuery,
                         LeafReaderContext context, Bits acceptDocs,
-                        Map<Term, TermContext> termContexts) throws IOException {
+                        Map<Term, TermContext> termContexts)
+            throws IOException {
         this();
         query = simpleSpanQuery;
         collectPayloads = query.isCollectPayloads();
@@ -76,7 +77,7 @@
      * document.
      * 
      * @return true iff such a document exists.
-     * */
+     */
     protected boolean ensureSameDoc (Spans x, Spans y) throws IOException {
         while (x.doc() != y.doc()) {
             if (x.doc() < y.doc()) {
@@ -100,7 +101,7 @@
      * Find the same doc shared by element, firstspan and secondspan.
      * 
      * @return true iff such a doc is found.
-     * */
+     */
     protected boolean findSameDoc (Spans x, Spans y, Spans e)
             throws IOException {
 
@@ -148,12 +149,10 @@
 
     @Override
     public String toString () {
-        return getClass().getName()
-                + "("
-                + query.toString()
-                + ")@"
-                + (isStartEnumeration ? "START" : (hasMoreSpans ? (doc() + ":"
-                        + start() + "-" + end()) : "END"));
+        return getClass().getName() + "(" + query.toString() + ")@"
+                + (isStartEnumeration ? "START"
+                        : (hasMoreSpans ? (doc() + ":" + start() + "-" + end())
+                                : "END"));
     }
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
index 30e57ef..bc80e69 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
@@ -31,7 +31,7 @@
  * constraints have to be formulated in Conjunctive Normal Form (CNF).
  * 
  * @author margaretha
- * */
+ */
 public class SpansWithAttribute extends SimpleSpans {
 
     private SimpleSpans referentSpans;
@@ -298,7 +298,7 @@
      * Advances the element or attribute spans to be in the same
      * document and
      * start position.
-     * */
+     */
     private boolean ensureSamePosition (SimpleSpans spans,
             AttributeSpans attributes) throws IOException {
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
index 57f8362..4989957 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
@@ -178,9 +178,10 @@
         cs.setDoc(firstSpans.doc());
 
         if (DEBUG) {
-            log.trace("Start at absolute position {} "
-                    + "and end at absolute position {}", cs.getStart(),
-                    cs.getEnd());
+            log.trace(
+                    "Start at absolute position {} "
+                            + "and end at absolute position {}",
+                    cs.getStart(), cs.getEnd());
         };
 
         return true;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/TermSpansWithId.java b/src/main/java/de/ids_mannheim/korap/query/spans/TermSpansWithId.java
index 0135fca..a8a4b14 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/TermSpansWithId.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/TermSpansWithId.java
@@ -23,7 +23,7 @@
  * payload.
  * 
  * @author margaretha
- * */
+ */
 public class TermSpansWithId extends SimpleSpans {
 
     private TermSpans termSpans;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
index a33e219..dbdf130 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
@@ -24,7 +24,7 @@
  * maximum end positions of the child spans.
  * 
  * @author margaretha
- * */
+ */
 public class TokenDistanceSpans extends OrderedDistanceSpans {
 
     /**
@@ -71,7 +71,7 @@
      * list
      * prepared for the previous second spans.
      * 
-     * */
+     */
     private void copyPossibleCandidates () {
         List<CandidateSpan> temp = new ArrayList<>();
         for (CandidateSpan cs : candidateList) {
@@ -85,7 +85,7 @@
     /**
      * Add new possible firstspan candidates for the current
      * secondspan.
-     * */
+     */
     private void addNewCandidates () throws IOException {
         while (hasMoreFirstSpans && firstSpans.doc() == candidateListDocNum
                 && firstSpans.start() < secondSpans.end()) {
@@ -101,9 +101,8 @@
     @Override
     protected boolean findMatch () throws IOException {
         CandidateSpan candidateSpan = candidateList.get(candidateListIndex);
-        if (minDistance == 0
-                &&
-                // intersection
+        if (minDistance == 0 &&
+        // intersection
                 candidateSpan.getStart() < secondSpans.end()
                 && secondSpans.start() < candidateSpan.getEnd()) {
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
index 3088b9f..72876ab 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
@@ -23,7 +23,7 @@
  * order.
  * 
  * @author margaretha
- * */
+ */
 public abstract class UnorderedDistanceSpans extends DistanceSpans {
 
     protected int minDistance, maxDistance;
@@ -260,7 +260,7 @@
      * to the match list.
      * 
      * @return a candidate span match
-     * */
+     */
     protected CandidateSpan createMatchCandidate (CandidateSpan target,
             CandidateSpan cs, boolean isDistanceZero) {
 
@@ -278,7 +278,8 @@
                 payloads.addAll(cs.getPayloads());
             }
         }
-        CandidateSpan match = new CandidateSpan(start, end, doc, cost, payloads);
+        CandidateSpan match = new CandidateSpan(start, end, doc, cost,
+                payloads);
         match.setChildSpan(cs);
         return match;
     }
@@ -288,7 +289,7 @@
      * Assigns the first candidate span in the match list as the
      * current span
      * match, and removes it from the matchList.
-     * */
+     */
     private void setMatchProperties () {
         CandidateSpan cs = matchList.get(0);
         matchDocNumber = cs.getDoc();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedElementDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedElementDistanceSpans.java
index 0fec0af..6850ab4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedElementDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedElementDistanceSpans.java
@@ -26,7 +26,7 @@
  * the spans.
  * 
  * @author margaretha
- * */
+ */
 public class UnorderedElementDistanceSpans extends UnorderedDistanceSpans {
 
     private Spans elements;
@@ -147,9 +147,8 @@
      */
     private int findElementPosition (Spans span) throws IOException {
         // Check in the element list
-        if (!elementList.isEmpty()
-                && span.end() <= elementList.get(elementList.size() - 1)
-                        .getEnd()) {
+        if (!elementList.isEmpty() && span.end() <= elementList
+                .get(elementList.size() - 1).getEnd()) {
 
             for (CandidateSpan e : elementList)
                 if (e.getEnd() >= span.end() && e.getStart() <= span.start()) {
@@ -223,18 +222,20 @@
      * @return <code>true</code> if the target and candidate spans are
      *         within
      *         the maximum distance, <code>false</code> otherwise.
-     * */
+     */
     protected boolean isWithinMaxDistance (CandidateSpan target,
             CandidateSpan candidate) {
         int candidatePos = candidate.getPosition();
         int targetPos = target.getPosition();
 
         // left candidate
-        if (candidatePos < targetPos && candidatePos + maxDistance < targetPos) {
+        if (candidatePos < targetPos
+                && candidatePos + maxDistance < targetPos) {
             return false;
         }
         // right candidate
-        if (candidatePos > targetPos && targetPos + maxDistance < candidatePos) {
+        if (candidatePos > targetPos
+                && targetPos + maxDistance < candidatePos) {
             return false;
         }
         return true;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedTokenDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedTokenDistanceSpans.java
index a8013bb..5c1350c 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedTokenDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedTokenDistanceSpans.java
@@ -21,7 +21,7 @@
  * distance is a token position.
  * 
  * @author margaretha
- * */
+ */
 public class UnorderedTokenDistanceSpans extends UnorderedDistanceSpans {
 
     /**
@@ -105,7 +105,8 @@
      *         within
      *         the maximum distance, <code>false</code> otherwise.
      */
-    protected boolean isWithinMaxDistance (CandidateSpan target, Spans candidate) {
+    protected boolean isWithinMaxDistance (CandidateSpan target,
+            Spans candidate) {
         // left candidate
         if (candidate.end() < target.getStart()
                 && candidate.end() + maxDistance <= target.getStart()) {
@@ -127,9 +128,8 @@
         List<CandidateSpan> matches = new ArrayList<>();
         int actualDistance;
         for (CandidateSpan cs : candidateList) {
-            if (minDistance == 0
-                    &&
-                    // intersection
+            if (minDistance == 0 &&
+            // intersection
                     target.getStart() < cs.getEnd()
                     && cs.getStart() < target.getEnd()) {
                 matches.add(createMatchCandidate(target, cs, true));
@@ -144,7 +144,8 @@
                 // right candidate
                 actualDistance = cs.getStart() - target.getEnd() + 1;
             }
-            if (minDistance <= actualDistance && actualDistance <= maxDistance) {
+            if (minDistance <= actualDistance
+                    && actualDistance <= maxDistance) {
                 matches.add(createMatchCandidate(target, cs, false));
             }
         }
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
index 9234716..fe507d9 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
@@ -303,7 +303,9 @@
                 // Fetch from second store?
                 else {
 
-                    /** TODO: Change this to a single embedded object! */
+                    /**
+                     * TODO: Change this to a single embedded object!
+                     */
                     this.embeddedStart = current.start;
                     this.embeddedEnd = current.end;
                     this.embeddedDoc = current.doc;
@@ -338,7 +340,8 @@
             // shift the stored spans
             if (!this.spanStore1.isEmpty()) {
                 if (DEBUG) {
-                    log.trace("Move everything from SpanStore 1 to SpanStore 2:");
+                    log.trace(
+                            "Move everything from SpanStore 1 to SpanStore 2:");
                     for (WithinSpan i : this.spanStore1) {
                         log.trace("     | {}", i.toString());
                     };
@@ -372,8 +375,8 @@
                 this.wrapDoc = this.wrapSpans.doc();
 
                 if (DEBUG)
-                    log.trace("   Forward wrap span to {}", _currentWrap()
-                            .toString());
+                    log.trace("   Forward wrap span to {}",
+                            _currentWrap().toString());
 
                 if (this.embeddedDoc != this.wrapDoc) {
                     if (DEBUG)
@@ -842,8 +845,8 @@
 
     private WithinSpan _currentWrap () {
         WithinSpan _wrap = new WithinSpan();
-        _wrap.start = this.wrapStart != -1 ? this.wrapStart : this.wrapSpans
-                .start();
+        _wrap.start = this.wrapStart != -1 ? this.wrapStart
+                : this.wrapSpans.start();
         _wrap.end = this.wrapEnd != -1 ? this.wrapEnd : this.wrapSpans.end();
         _wrap.doc = this.wrapDoc != -1 ? this.wrapDoc : this.wrapSpans.doc();
         return _wrap;
@@ -874,7 +877,7 @@
           - storeEmbedded -> store span B for later checks
           - nextSpanA     -> forward a
           - nextSpanB     -> forward b
-
+        
           These rules were automatically generated
         */
 
@@ -1174,12 +1177,10 @@
 
     @Override
     public String toString () {
-        return getClass().getName()
-                + "("
-                + query.toString()
-                + ")@"
-                + (embeddedDoc <= 0 ? "START" : (more ? (doc() + ":" + start()
-                        + "-" + end()) : "END"));
+        return getClass().getName() + "(" + query.toString() + ")@"
+                + (embeddedDoc <= 0 ? "START"
+                        : (more ? (doc() + ":" + start() + "-" + end())
+                                : "END"));
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
index 8fd18cd..9b71cbf 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
@@ -48,8 +48,8 @@
         this.alternatives = new ArrayList<>();
         for (String term : terms) {
             this.isNull = false;
-            this.alternatives.add(new SpanSimpleQueryWrapper(new SpanTermQuery(
-                    new Term(this.field, term))));
+            this.alternatives.add(new SpanSimpleQueryWrapper(
+                    new SpanTermQuery(new Term(this.field, term))));
         };
     };
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
index 0d0fe23..d2941f9 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
@@ -8,7 +8,7 @@
 
 /**
  * @author margaretha
- * */
+ */
 public class SpanAttributeQueryWrapper extends SpanQueryWrapper {
 
     private SpanQueryWrapper subquery;
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanClassQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanClassQueryWrapper.java
index 51d4ab7..c06194f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanClassQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanClassQueryWrapper.java
@@ -70,8 +70,8 @@
         if (this.subquery.isNull())
             return (SpanQuery) null;
 
-        SpanQuery sq = (SpanQuery) this.subquery
-                .retrieveNode(this.retrieveNode).toFragmentQuery();
+        SpanQuery sq = (SpanQuery) this.subquery.retrieveNode(this.retrieveNode)
+                .toFragmentQuery();
 
         if (sq == null)
             return (SpanQuery) null;
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanExpansionQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanExpansionQueryWrapper.java
index 7c4cf61..f4011c2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanExpansionQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanExpansionQueryWrapper.java
@@ -8,7 +8,6 @@
 import de.ids_mannheim.korap.query.SpanExpansionQuery;
 import de.ids_mannheim.korap.util.QueryException;
 
-
 import java.util.*;
 
 /*
@@ -21,48 +20,41 @@
 public class SpanExpansionQueryWrapper extends SpanQueryWrapper {
     private SpanQueryWrapper anchor;
 
-	// < 0 	to the left of anchor span 
+    // < 0 	to the left of anchor span 
     // >= 0  to the right of anchor span
-	private int direction;
+    private int direction;
 
-	// if > 0, collect expansion offsets
-	// using this label
+    // if > 0, collect expansion offsets
+    // using this label
     private byte classNumber;
 
 
-    public SpanExpansionQueryWrapper (SpanQueryWrapper anchor,
-									  int min,
-									  int max,
-									  int direction,
-									  byte classNumber
-		) {
-		this.anchor = anchor;
-		this.isNull = false;
-		this.min = min;
-		this.max = max;
-		this.direction = direction;
-		this.classNumber = classNumber;
-		this.isExtended = true;
-		if (direction >= 0)
-			this.isExtendedToTheRight = true;
+    public SpanExpansionQueryWrapper (SpanQueryWrapper anchor, int min, int max,
+                                      int direction, byte classNumber) {
+        this.anchor = anchor;
+        this.isNull = false;
+        this.min = min;
+        this.max = max;
+        this.direction = direction;
+        this.classNumber = classNumber;
+        this.isExtended = true;
+        if (direction >= 0)
+            this.isExtendedToTheRight = true;
     };
 
-	@Override
+
+    @Override
     public boolean isNull () {
-		// Needs to be overwritten, as min and max do not indicate null value
+        // Needs to be overwritten, as min and max do not indicate null value
         return this.isNull;
     };
-	
 
-	@Override
+
+    @Override
     public SpanQuery toFragmentQuery () throws QueryException {
-		return new SpanExpansionQuery(
-			this.anchor.retrieveNode(this.retrieveNode).toFragmentQuery(),
-			this.getMin(),
-			this.getMax(),
-			this.direction,
-			this.classNumber,
-			true
-			);
+        return new SpanExpansionQuery(
+                this.anchor.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                this.getMin(), this.getMax(), this.direction, this.classNumber,
+                true);
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanFocusQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanFocusQueryWrapper.java
index 8fadb3e..89d8f65 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanFocusQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanFocusQueryWrapper.java
@@ -52,8 +52,9 @@
     public SpanQuery toFragmentQuery () throws QueryException {
         if (this.subquery.isNull())
             return (SpanQuery) null;
-        return new SpanFocusQuery(this.subquery.retrieveNode(this.retrieveNode)
-                .toFragmentQuery(), this.number);
+        return new SpanFocusQuery(
+                this.subquery.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                this.number);
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
index f0221d5..c6e1355 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
@@ -95,8 +95,8 @@
         return this.isOptional;
     };
 
-	
-	public SpanQueryWrapper isOptional (boolean opt) {
+
+    public SpanQueryWrapper isOptional (boolean opt) {
         this.isOptional = opt;
         return this;
     };
@@ -219,6 +219,7 @@
         return this;
     };
 
+
     /**
      * Check, if the wrapped query can be used as an
      * anchor query in a sequence, i.e. a query that
@@ -419,10 +420,10 @@
      */
     public String toString () {
         String string = "" + (this.isNull() ? "isNull" : "notNull") + "-"
-			+ (this.isEmpty() ? "isEmpty" : "notEmpty") + "-"
-			+ (this.isOptional() ? "isOptional" : "notOptional") + "-"
-			+ (this.isExtendedToTheRight() ? "isExtendedToTheRight" : "notExtendedToTheRight");
-		;
+                + (this.isEmpty() ? "isEmpty" : "notEmpty") + "-"
+                + (this.isOptional() ? "isOptional" : "notOptional") + "-"
+                + (this.isExtendedToTheRight() ? "isExtendedToTheRight"
+                        : "notExtendedToTheRight");;
         return string;
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
index 65c4da6..808b064 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
@@ -101,8 +101,9 @@
                     .toFragmentQuery();
 
         // That's a fine repetition query
-        return new SpanRepetitionQuery(this.subquery.retrieveNode(
-                this.retrieveNode).toFragmentQuery(), this.min, this.max, true);
+        return new SpanRepetitionQuery(
+                this.subquery.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                this.min, this.max, true);
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
index 1b1929b..8623671 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
@@ -196,7 +196,8 @@
 
 
     public SpanQuery toFragmentQuery () throws QueryException {
-        if (this.isNull || (this.inclusive.size() + this.exclusive.size() == 0)) {
+        if (this.isNull
+                || (this.inclusive.size() + this.exclusive.size() == 0)) {
             return (SpanQuery) null;
         }
         else if (this.inclusive.size() >= 1 && this.exclusive.size() >= 1) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
index c5aac76..2a263a6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
@@ -89,8 +89,8 @@
     public SpanSequenceQueryWrapper (String field, String ... terms) {
         this(field);
         for (int i = 0; i < terms.length; i++) {
-            this.segments.add(new SpanSimpleQueryWrapper(new SpanTermQuery(
-                    new Term(field, terms[i]))));
+            this.segments.add(new SpanSimpleQueryWrapper(
+                    new SpanTermQuery(new Term(field, terms[i]))));
         };
         // Query can't be null anymore
         this.isNull = false;
@@ -133,8 +133,8 @@
         if (DEBUG) {
             if (!sswq.isEmpty()) {
                 try {
-                    log.trace("New span sequence {}", sswq.toFragmentQuery()
-                            .toString());
+                    log.trace("New span sequence {}",
+                            sswq.toFragmentQuery().toString());
                 }
                 catch (QueryException qe) {
                     log.trace("Unable to serialize query {}", qe.getMessage());
@@ -392,8 +392,8 @@
             this.constraints = new ArrayList<DistanceConstraint>(1);
         if (DEBUG)
             log.trace("With contraint {}-{} (excl {})", min, max, exclusion);
-        this.constraints.add(new DistanceConstraint(min, max, this.isInOrder,
-                exclusion));
+        this.constraints.add(
+                new DistanceConstraint(min, max, this.isInOrder, exclusion));
         return this;
     };
 
@@ -476,8 +476,8 @@
             String unit, boolean exclusion) {
 
         if (DEBUG)
-            log.trace("With contraint {}-{} (unit {}, excl {})", min, max,
-                    unit, exclusion);
+            log.trace("With contraint {}-{} (unit {}, excl {})", min, max, unit,
+                    exclusion);
 
         // Word unit
         if (unit.equals("w")) {
@@ -486,15 +486,15 @@
             if (this.constraints == null)
                 this.constraints = new ArrayList<DistanceConstraint>(1);
 
-            this.constraints.add(new DistanceConstraint(min, max, isInOrder,
-                    exclusion));
+            this.constraints.add(
+                    new DistanceConstraint(min, max, isInOrder, exclusion));
 
             return this;
         };
 
         // Element unit (sentence or paragraph)
-        return this.withConstraint(min, max, new SpanElementQueryWrapper(
-                this.field, unit), exclusion);
+        return this.withConstraint(min, max,
+                new SpanElementQueryWrapper(this.field, unit), exclusion);
     };
 
 
@@ -545,9 +545,10 @@
         // Element unit (sentence or paragraph)
         // Todo: This should possibly be evaluated to a query later on!
         try {
-            this.constraints.add(new DistanceConstraint((SpanElementQuery) unit
-                    .retrieveNode(this.retrieveNode).toFragmentQuery(), min,
-                    max, isInOrder, exclusion));
+            this.constraints.add(new DistanceConstraint(
+                    (SpanElementQuery) unit.retrieveNode(this.retrieveNode)
+                            .toFragmentQuery(),
+                    min, max, isInOrder, exclusion));
         }
         catch (QueryException qe) {
             this.constraintException = qe;
@@ -741,7 +742,7 @@
             return (SpanQuery) query;
         };
 
-		// DistanceQueries with problems
+        // DistanceQueries with problems
         if (this.hasConstraints() && this.isProblematic) {
             throw new QueryException(613,
                     "Distance constraints not supported with empty, optional or negative operands");
@@ -769,8 +770,8 @@
                     if (sq == null)
                         continue;
 
-                    SpanDistanceQuery sdquery = new SpanDistanceQuery(query,
-                            sq, constraint, true);
+                    SpanDistanceQuery sdquery = new SpanDistanceQuery(query, sq,
+                            constraint, true);
                     query = (SpanQuery) sdquery;
                 };
             }
@@ -793,8 +794,8 @@
                     if (sq == null)
                         continue;
 
-                    SpanDistanceQuery sdquery = new SpanDistanceQuery(query,
-                            sq, constraint, true);
+                    SpanDistanceQuery sdquery = new SpanDistanceQuery(query, sq,
+                            constraint, true);
                     query = (SpanQuery) sdquery;
                 };
             };
@@ -828,12 +829,12 @@
       segments to extensions).
       This has to be done as long as there are problematic segments
       In the queries.
-
+    
       While there is a segment isNegative() or isOptional() or isEmpty() do
       - look for an anchor next to it
       - merge the problematic segment with the anchor
       - go on
-
+    
       - This does not work for distance constraints!
     */
     private boolean _solveProblematicSequence () {
@@ -875,8 +876,7 @@
 
                     // Insert the solution
                     try {
-                        this.segments.set(
-                                i + 1,
+                        this.segments.set(i + 1,
                                 _merge(this.segments.get(i + 1), underScrutiny,
                                         false));
                     }
@@ -906,10 +906,8 @@
 
                     // Insert the solution
                     try {
-                        this.segments.set(
-                                i - 1,
-                                _merge(this.segments.get(i - 1), underScrutiny,
-                                        true));
+                        this.segments.set(i - 1, _merge(
+                                this.segments.get(i - 1), underScrutiny, true));
                     }
                     catch (QueryException e) {
                         this.isSolved = true;
@@ -969,8 +967,8 @@
         int direction = mergeLeft ? 1 : -1;
 
         if (DEBUG)
-            log.trace("Will merge two spans to {}", mergeLeft ? "left"
-                    : "right");
+            log.trace("Will merge two spans to {}",
+                    mergeLeft ? "left" : "right");
 
         // Make empty extension to anchor
         if (problem.isEmpty()) {
@@ -980,46 +978,44 @@
                 log.trace("Problem is empty with class {}",
                         problem.getClassNumber());
 
-			// Merge extensions!
-			if (!problem.hasClass() &&
-				!anchor.hasClass() &&
-				anchor.isExtended()) {
+            // Merge extensions!
+            if (!problem.hasClass() && !anchor.hasClass()
+                    && anchor.isExtended()) {
 
-				if (DEBUG)
-					log.trace("It may be possible to extend anchor with problem");
-				
-				if (
-					// Further extend to the right ...
-					(direction >= 0 && anchor.isExtendedToTheRight) ||
+                if (DEBUG)
+                    log.trace(
+                            "It may be possible to extend anchor with problem");
 
-					// or the left
-					(direction < 0 && !anchor.isExtendedToTheRight)) {
+                if (
+                // Further extend to the right ...
+                (direction >= 0 && anchor.isExtendedToTheRight) ||
 
-					if (DEBUG)
-						log.trace("Readjust min and max");
+                // or the left
+                        (direction < 0 && !anchor.isExtendedToTheRight)) {
 
-					// Readjust the anchor
-					anchor.setMin(anchor.getMin() + problem.getMin());
-					anchor.setMax(anchor.getMax() + problem.getMax());
+                    if (DEBUG)
+                        log.trace("Readjust min and max");
 
-					/*
-					 * This is wrong - min is only relevant for extensions
-					if (anchor.getMin() > 0)
-						anchor.isOptional = false;
-					*/					
-					return anchor;
-				};
-			};
+                    // Readjust the anchor
+                    anchor.setMin(anchor.getMin() + problem.getMin());
+                    anchor.setMax(anchor.getMax() + problem.getMax());
 
-			// Can't merge extensions
-			SpanQueryWrapper sqw = new SpanExpansionQueryWrapper(
-				anchor,
-				problem.isOptional() ? 0 : problem.getMin(),
-				problem.getMax(),
-				direction,
-				problem.hasClass() ? problem.getClassNumber() : (byte) 0
-				).isExtended(true);
-				
+                    /*
+                     * This is wrong - min is only relevant for extensions
+                    if (anchor.getMin() > 0)
+                    	anchor.isOptional = false;
+                    */
+                    return anchor;
+                };
+            };
+
+            // Can't merge extensions
+            SpanQueryWrapper sqw = new SpanExpansionQueryWrapper(anchor,
+                    problem.isOptional() ? 0 : problem.getMin(),
+                    problem.getMax(), direction,
+                    problem.hasClass() ? problem.getClassNumber() : (byte) 0)
+                            .isExtended(true);
+
             // Set right extension
             if (direction >= 0)
                 sqw.isExtendedToTheRight(true);
@@ -1036,17 +1032,17 @@
                 log.trace("Problem is negative with class {}",
                         problem.getClassNumber());
 
-			// TODO: Should probably wrapped as well!
-			// A sequence of negative tokens may expand jointly!
-			query = new SpanExpansionQuery(anchor.retrieveNode(
-											   this.retrieveNode).toFragmentQuery(), problem.retrieveNode(
-												   this.retrieveNode).toFragmentQuery(), problem.getMin(),
-										   problem.getMax(), direction,
-										   problem.hasClass() ? problem.getClassNumber() : (byte) 0,
-										   true);
+            // TODO: Should probably wrapped as well!
+            // A sequence of negative tokens may expand jointly!
+            query = new SpanExpansionQuery(
+                    anchor.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                    problem.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                    problem.getMin(), problem.getMax(), direction,
+                    problem.hasClass() ? problem.getClassNumber() : (byte) 0,
+                    true);
 
             SpanQueryWrapper sqw = new SpanSimpleQueryWrapper(query)
-				.isExtended(true);
+                    .isExtended(true);
 
             // Set right extension
             if (direction >= 0)
@@ -1058,29 +1054,25 @@
         if (DEBUG)
             log.trace("Problem is optional");
 
-		// [base=der][][base=Baum]?
+        // [base=der][][base=Baum]?
         // [base=der][base=baum]?
 
         // [base=der]
-        SpanAlterQueryWrapper saqw = new SpanAlterQueryWrapper(
-			this.field,
-			anchor
-			);
+        SpanAlterQueryWrapper saqw = new SpanAlterQueryWrapper(this.field,
+                anchor);
 
         // [base=der]
-        SpanSequenceQueryWrapper ssqw = new SpanSequenceQueryWrapper(
-			this.field,
-			anchor
-			);
+        SpanSequenceQueryWrapper ssqw = new SpanSequenceQueryWrapper(this.field,
+                anchor);
 
         // [base=der][base=baum]
-	    if (mergeLeft) {
+        if (mergeLeft) {
             ssqw.append(problem.isOptional(false));
-		}
+        }
         // [base=baum][base=der]
         else {
             ssqw.prepend(problem.isOptional(false));
-		}
+        }
 
         saqw.or(ssqw);
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSimpleQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSimpleQueryWrapper.java
index 3d9c76a..cdf4619 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSimpleQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSimpleQueryWrapper.java
@@ -26,18 +26,20 @@
         this.query = query;
     };
 
-	// This is similar to a clone
-	public SpanSimpleQueryWrapper (SpanQueryWrapper query) throws QueryException {
-		this.hasClass = query.hasClass();
-		this.isOptional = query.isOptional();
-		this.isNegative = query.isNegative();
-		this.isEmpty = query.isEmpty();
-		this.isExtended = query.isExtended();
-		this.isExtendedToTheRight = query.isExtendedToTheRight();
-		this.maybeUnsorted = query.maybeUnsorted();
-		this.retrieveNode = query.retrieveNode;
-		this.query = query.toFragmentQuery();
-		this.isNull = query.isNull();
+
+    // This is similar to a clone
+    public SpanSimpleQueryWrapper (SpanQueryWrapper query)
+            throws QueryException {
+        this.hasClass = query.hasClass();
+        this.isOptional = query.isOptional();
+        this.isNegative = query.isNegative();
+        this.isEmpty = query.isEmpty();
+        this.isExtended = query.isExtended();
+        this.isExtendedToTheRight = query.isExtendedToTheRight();
+        this.maybeUnsorted = query.maybeUnsorted();
+        this.retrieveNode = query.retrieveNode;
+        this.query = query.toFragmentQuery();
+        this.isNull = query.isNull();
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
index d311a27..7e91844 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
@@ -25,7 +25,8 @@
 
 
     public SpanSubspanQueryWrapper (SpanQueryWrapper sqw, int startOffset,
-                                    int length) throws QueryException {
+                                    int length)
+            throws QueryException {
         if (length < 0) {
             throw new QueryException(
                     "SpanSubspanQuery cannot have length less than 0.");
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithAttributeQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithAttributeQueryWrapper.java
index 435b3ee..266e051 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithAttributeQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithAttributeQueryWrapper.java
@@ -15,7 +15,7 @@
  * No optimization using expansion
  * 
  * @author margaretha
- * */
+ */
 public class SpanWithAttributeQueryWrapper extends SpanQueryWrapper {
 
     private SpanQueryWrapper withIdQueryWrapper = null;
@@ -33,7 +33,8 @@
             return;
         }
         if (attrQuery.isNegative) {
-            throw new QueryException("The query requires a positive attribute.");
+            throw new QueryException(
+                    "The query requires a positive attribute.");
         }
         this.attrQueryWrapper = attrQuery;
         this.isSingleAttribute = true;
@@ -153,7 +154,8 @@
 
     private SpanWithAttributeQuery createSpanWithSingleAttributeQuery (
             SimpleSpanQuery withIdQuery) throws QueryException {
-        SpanAttributeQuery attrQuery = createSpanAttributeQuery(this.attrQueryWrapper);
+        SpanAttributeQuery attrQuery = createSpanAttributeQuery(
+                this.attrQueryWrapper);
         if (attrQuery != null) {
             if (withIdQuery != null) {
                 return new SpanWithAttributeQuery(withIdQuery, attrQuery, true);
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
index dc1f449..576b1e0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
@@ -96,9 +96,10 @@
 
         // TODO: if (wrap.isNegative())
 
-        return new SpanWithinQuery(this.element.retrieveNode(this.retrieveNode)
-                .toFragmentQuery(), this.wrap.retrieveNode(this.retrieveNode)
-                .toFragmentQuery(), this.flag);
+        return new SpanWithinQuery(
+                this.element.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                this.wrap.retrieveNode(this.retrieveNode).toFragmentQuery(),
+                this.flag);
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 965c736..4bf7109 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -602,7 +602,8 @@
     /**
      * Get identifier for a specific position.
      * 
-     * @param int Position to get identifier on.
+     * @param int
+     *            Position to get identifier on.
      */
     @JsonIgnore
     public String getPosID (int pos) {
@@ -693,8 +694,8 @@
                         && contextSpans.end() >= this.getStartPos()) {
 
                     // Set as newStart
-                    newStart = contextSpans.start() > newStart ? contextSpans
-                            .start() : newStart;
+                    newStart = contextSpans.start() > newStart
+                            ? contextSpans.start() : newStart;
 
                     if (DEBUG)
                         log.trace("NewStart is at {}", newStart);
@@ -920,7 +921,8 @@
      * This takes a clean string and the tag stack
      * to decorate the string with annotations.
      */
-    private void _processHighlightSnippet (String clean, ArrayList<int[]> stack) {
+    private void _processHighlightSnippet (String clean,
+            ArrayList<int[]> stack) {
 
         if (DEBUG)
             log.trace("--- Process Highlight snippet");
@@ -1294,15 +1296,16 @@
             if (this.context.right.isToken()) {
                 endOffset = this.endPos + this.context.right.getLength() - 1;
                 if (DEBUG)
-                    log.trace("PTO will retrieve {} (Right context)", endOffset);
+                    log.trace("PTO will retrieve {} (Right context)",
+                            endOffset);
                 pto.add(ldid, endOffset);
 
             }
 
             // The right context is defined by characters
             else {
-                endOffsetChar = (endPosChar == -1) ? -1 : endPosChar
-                        + this.context.right.getLength();
+                endOffsetChar = (endPosChar == -1) ? -1
+                        : endPosChar + this.context.right.getLength();
             };
 
             if (startOffset != -1)
@@ -1336,7 +1339,8 @@
                     endOffsetChar);
 
         // Get snippet information from the primary data
-        if (endOffsetChar > -1 && (endOffsetChar < this.getPrimaryDataLength())) {
+        if (endOffsetChar > -1
+                && (endOffsetChar < this.getPrimaryDataLength())) {
             this.tempSnippet = this.getPrimaryData(startOffsetChar,
                     endOffsetChar);
         }
@@ -1351,8 +1355,8 @@
         if (DEBUG)
             log.trace(
                     "The match entry is {}-{} ({}-{}) with absolute offsetChars {}-{}",
-                    startPosChar - startOffsetChar, endPosChar
-                            - startOffsetChar, startPosChar, endPosChar,
+                    startPosChar - startOffsetChar,
+                    endPosChar - startOffsetChar, startPosChar, endPosChar,
                     startOffsetChar, endOffsetChar);
 
         // TODO: Simplify
diff --git a/src/main/java/de/ids_mannheim/korap/response/Response.java b/src/main/java/de/ids_mannheim/korap/response/Response.java
index 5108199..3d27919 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Response.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Response.java
@@ -206,8 +206,7 @@
     public Response setBenchmark (long ts1, long ts2) {
         this.benchmark = (ts2 - ts1) < 100_000_000 ?
         // Store as miliseconds
-        (((double) (ts2 - ts1) * 1e-6) + " ms")
-                :
+                (((double) (ts2 - ts1) * 1e-6) + " ms") :
                 // Store as seconds
                 (((double) (ts2 - ts1) / 1000000000.0) + " s");
         return this;
diff --git a/src/main/java/de/ids_mannheim/korap/response/Result.java b/src/main/java/de/ids_mannheim/korap/response/Result.java
index 83d08f4..0dabb24 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Result.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Result.java
@@ -89,8 +89,8 @@
         this.matches = new ArrayList<>(itemsPerPage);
         this.serialQuery = query;
         this.startIndex = startIndex;
-        this.itemsPerPage = (itemsPerPage > ITEMS_PER_PAGE_MAX || itemsPerPage < 1) ? ITEMS_PER_PAGE
-                : itemsPerPage;
+        this.itemsPerPage = (itemsPerPage > ITEMS_PER_PAGE_MAX
+                || itemsPerPage < 1) ? ITEMS_PER_PAGE : itemsPerPage;
         this.context = context;
     };
 
diff --git a/src/main/java/de/ids_mannheim/korap/response/collector/MatchCollectorDB.java b/src/main/java/de/ids_mannheim/korap/response/collector/MatchCollectorDB.java
index 0c5a604..26c5c97 100644
--- a/src/main/java/de/ids_mannheim/korap/response/collector/MatchCollectorDB.java
+++ b/src/main/java/de/ids_mannheim/korap/response/collector/MatchCollectorDB.java
@@ -140,8 +140,8 @@
             };
 
             // Prepare statement based on the string
-            PreparedStatement prep = this.connection.prepareStatement(sb
-                    .toString());
+            PreparedStatement prep = this.connection
+                    .prepareStatement(sb.toString());
 
             int i = 1;
             ListIterator li = this.matchCollector.listIterator();
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinator.java b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinator.java
index 8292e4a..386afff 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinator.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinator.java
@@ -109,9 +109,11 @@
             lastComb = this.combine.peekLast();
 
             if (DEBUG)
-                log.trace("Closing element is unbalanced - {} "
-                        + "!= {} with lastComb {}|{}|{}", eold, number,
-                        lastComb.type, lastComb.number, lastComb.characters);
+                log.trace(
+                        "Closing element is unbalanced - {} "
+                                + "!= {} with lastComb {}|{}|{}",
+                        eold, number, lastComb.type, lastComb.number,
+                        lastComb.characters);
 
             // combinator is opening and the number is not equal to the last
             // element on the balanceStack
@@ -128,8 +130,8 @@
                     log.trace("close element a) {}", eold);
 
                 // Add a closer for the old element (this has following elements)
-                this.combine.add(new HighlightCombinatorElement((byte) 2, eold,
-                        false));
+                this.combine.add(
+                        new HighlightCombinatorElement((byte) 2, eold, false));
             };
 
             // add this element number temporarily on the stack
@@ -143,8 +145,8 @@
         lastComb = this.combine.peekLast();
 
         if (DEBUG) {
-            log.trace("LastComb: " + lastComb.type + '|' + lastComb.number
-                    + '|' + lastComb.characters + " for " + number);
+            log.trace("LastComb: " + lastComb.type + '|' + lastComb.number + '|'
+                    + lastComb.characters + " for " + number);
             log.trace("Stack for checking 2: {}|{}|{}|{}", lastComb.type,
                     lastComb.number, lastComb.characters, number);
         };
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
index 9762aef..ffc9638 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
@@ -33,7 +33,8 @@
     // Constructor for highlighting elements,
     // that may not be terminal, i.e. they were closed and will
     // be reopened for overlapping issues.
-    public HighlightCombinatorElement (byte type, int number, boolean terminal) {
+    public HighlightCombinatorElement (byte type, int number,
+                                       boolean terminal) {
         this.type = type;
         this.number = number;
         this.terminal = terminal;
@@ -60,16 +61,18 @@
 
             else if (this.number < -1) {
                 sb.append("<span xml:id=\"")
-                        .append(escapeHTML(match.getPosID(match
-                                .getClassID(this.number)))).append("\">");
+                        .append(escapeHTML(
+                                match.getPosID(match.getClassID(this.number))))
+                        .append("\">");
             }
 
             else if (this.number >= 256) {
                 sb.append("<span ");
                 if (this.number < 2048) {
                     sb.append("title=\"")
-                            .append(escapeHTML(match
-                                    .getAnnotationID(this.number))).append('"');
+                            .append(escapeHTML(
+                                    match.getAnnotationID(this.number)))
+                            .append('"');
                 }
                 else {
                     Relation rel = match.getRelationID(this.number);
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 e4b94ff..26d9c2c 100644
--- a/src/main/java/de/ids_mannheim/korap/server/Resource.java
+++ b/src/main/java/de/ids_mannheim/korap/server/Resource.java
@@ -292,8 +292,8 @@
 
         // Get the database
         try {
-            final MatchCollectorDB mc = new MatchCollectorDB(1000, "Res_"
-                    + resultID);
+            final MatchCollectorDB mc = new MatchCollectorDB(1000,
+                    "Res_" + resultID);
             final ComboPooledDataSource pool = Node.getDBPool();
             mc.setDBPool("mysql", pool, pool.getConnection());
 
@@ -348,7 +348,8 @@
     @GET
     @Path("/match/{matchID}")
     @Produces(MediaType.APPLICATION_JSON)
-    public String match (@PathParam("matchID") String id, @Context UriInfo uri) {
+    public String match (@PathParam("matchID") String id,
+            @Context UriInfo uri) {
 
         Response kresp = _initResponse();
         if (kresp.hasErrors())
@@ -361,7 +362,8 @@
         // Get query parameters
         MultivaluedMap<String, String> qp = uri.getQueryParameters();
 
-        boolean includeSpans = false, includeHighlights = true, extendToSentence = false, info = false;
+        boolean includeSpans = false, includeHighlights = true,
+                extendToSentence = false, info = false;
 
         // Optional query parameter "info" for more information on the match
         if (!_isNull(qp.getFirst("info")))
@@ -387,8 +389,9 @@
 
         try {
             // Get match info
-            return index.getMatchInfo(id, "tokens", info, foundries, layers,
-                    includeSpans, includeHighlights, extendToSentence)
+            return index
+                    .getMatchInfo(id, "tokens", info, foundries, layers,
+                            includeSpans, includeHighlights, extendToSentence)
                     .toJsonString();
         }
 
@@ -407,9 +410,9 @@
       POST /peek
       POST /?text_id=...
       POST /:text_id/
-
+    
       PUT /:text_id
-
+    
       DELETE /:text_id
       DELETE /:corpus_sigle
       DELETE /:corpus_sigle/:doc_sigle
diff --git a/src/main/java/de/ids_mannheim/korap/util/KrillString.java b/src/main/java/de/ids_mannheim/korap/util/KrillString.java
index d3da39d..3e0095e 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KrillString.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KrillString.java
@@ -28,7 +28,7 @@
      */
     public static String StringfromFile (String path, Charset encoding)
             throws IOException {
-        path = URLDecoder.decode(path,"UTF-8");
+        path = URLDecoder.decode(path, "UTF-8");
         path = path.replaceFirst("^/(.:/)", "$1");
         Path p = Paths.get(path);
         byte[] encoded = Files.readAllBytes(p);
diff --git a/src/test/java/de/ids_mannheim/korap/Test.java b/src/test/java/de/ids_mannheim/korap/Test.java
index 9f33803..1866549 100644
--- a/src/test/java/de/ids_mannheim/korap/Test.java
+++ b/src/test/java/de/ids_mannheim/korap/Test.java
@@ -43,7 +43,8 @@
 
         // Integer fields
         for (String s : strInt) {
-            doc.add(new IntField(s, Integer.parseInt(m.get(s)), Field.Store.YES));
+            doc.add(new IntField(s, Integer.parseInt(m.get(s)),
+                    Field.Store.YES));
         };
 
         FieldType textFieldWithTermVectors = new FieldType(
diff --git a/src/test/java/de/ids_mannheim/korap/TestSimple.java b/src/test/java/de/ids_mannheim/korap/TestSimple.java
index 6451ae4..7f4f8a1 100644
--- a/src/test/java/de/ids_mannheim/korap/TestSimple.java
+++ b/src/test/java/de/ids_mannheim/korap/TestSimple.java
@@ -109,7 +109,7 @@
 
     // Get string
     public static String getJsonString (String path) {
-        
+
         StringBuilder contentBuilder = new StringBuilder();
         try {
             path = URLDecoder.decode(path, "UTF-8");
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSamples.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSamples.java
index 535b1ce..b748a12 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSamples.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSamples.java
@@ -38,8 +38,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
index 26874c4..eae43b1 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
@@ -29,21 +29,21 @@
     @Test
     public void checkBenchmark1 () throws IOException {
         Properties prop = new Properties();
-        InputStream fr = new FileInputStream(getClass().getResource(
-                "/krill.properties").getFile());
+        InputStream fr = new FileInputStream(
+                getClass().getResource("/krill.properties").getFile());
         prop.load(fr);
 
         // Get the real index
-        KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
-                .getProperty("krill.indexDir"))));
+        KrillIndex ki = new KrillIndex(new MMapDirectory(
+                Paths.get(prop.getProperty("krill.indexDir"))));
 
         // Create a container for virtual collections:
         KrillCollection kc = new KrillCollection(ki);
 
         long t1 = 0, t2 = 0;
         /// cosmas20.json!!!
-        String json = getString(getClass().getResource(
-                "/queries/benchmark1.jsonld").getFile());
+        String json = getString(
+                getClass().getResource("/queries/benchmark1.jsonld").getFile());
 
         int rounds = 100;
 
@@ -83,21 +83,21 @@
     @Test
     public void checkBenchmark2JSON () throws IOException {
         Properties prop = new Properties();
-        InputStream fr = new FileInputStream(getClass().getResource(
-                "/krill.properties").getFile());
+        InputStream fr = new FileInputStream(
+                getClass().getResource("/krill.properties").getFile());
         prop.load(fr);
 
         // Get the real index
-        KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
-                .getProperty("krill.indexDir"))));
+        KrillIndex ki = new KrillIndex(new MMapDirectory(
+                Paths.get(prop.getProperty("krill.indexDir"))));
 
         // Create a container for virtual collections:
         KrillCollection kc = new KrillCollection(ki);
 
         long t1 = 0, t2 = 0;
         /// cosmas20.json!!!
-        String json = getString(getClass().getResource(
-                "/queries/benchmark2.jsonld").getFile());
+        String json = getString(
+                getClass().getResource("/queries/benchmark2.jsonld").getFile());
 
         int rounds = 10000;
 
@@ -129,21 +129,21 @@
     @Test
     public void checkBenchmarkSentences () throws IOException {
         Properties prop = new Properties();
-        InputStream fr = new FileInputStream(getClass().getResource(
-                "/krill.properties").getFile());
+        InputStream fr = new FileInputStream(
+                getClass().getResource("/krill.properties").getFile());
         prop.load(fr);
 
         // Get the real index
-        KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
-                .getProperty("krill.indexDir"))));
+        KrillIndex ki = new KrillIndex(new MMapDirectory(
+                Paths.get(prop.getProperty("krill.indexDir"))));
 
         // Create a container for virtual collections:
         KrillCollection kc = new KrillCollection(ki);
 
         long t1 = 0, t2 = 0;
         /// cosmas20.json!!!
-        String json = getString(getClass().getResource(
-                "/queries/benchmark4.jsonld").getFile());
+        String json = getString(
+                getClass().getResource("/queries/benchmark4.jsonld").getFile());
 
         int rounds = 10;
 
@@ -175,21 +175,21 @@
         // [orth=Der]{1:[orth=Mann]{2:[orth=und]}}
 
         Properties prop = new Properties();
-        InputStream fr = new FileInputStream(getClass().getResource(
-                "/krill.properties").getFile());
+        InputStream fr = new FileInputStream(
+                getClass().getResource("/krill.properties").getFile());
         prop.load(fr);
 
         // Get the real index
-        KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
-                .getProperty("krill.indexDir"))));
+        KrillIndex ki = new KrillIndex(new MMapDirectory(
+                Paths.get(prop.getProperty("krill.indexDir"))));
 
         // Create a container for virtual collections:
         KrillCollection kc = new KrillCollection(ki);
 
         long t1 = 0, t2 = 0;
         // Without classes
-        String json = getString(getClass().getResource(
-                "/queries/benchmark5-ohne.jsonld").getFile());
+        String json = getString(getClass()
+                .getResource("/queries/benchmark5-ohne.jsonld").getFile());
 
         int rounds = 2000;
 
@@ -208,8 +208,8 @@
         t1 = 0;
         t2 = 0;
         // With classes
-        json = getString(getClass().getResource("/queries/benchmark5.jsonld")
-                .getFile());
+        json = getString(
+                getClass().getResource("/queries/benchmark5.jsonld").getFile());
 
         t1 = System.nanoTime();
         for (int i = 1; i <= rounds; i++) {
@@ -224,8 +224,8 @@
         t1 = 0;
         t2 = 0;
         // With submatch
-        json = getString(getClass().getResource(
-                "/queries/benchmark5-submatch.jsonld").getFile());
+        json = getString(getClass()
+                .getResource("/queries/benchmark5-submatch.jsonld").getFile());
 
         t1 = System.nanoTime();
         for (int i = 1; i <= rounds; i++) {
@@ -295,9 +295,8 @@
 
             // Indexing test files
             for (String d : docs) {
-                FieldDocument fd = ki.addDoc(
-                        getClass().getResourceAsStream(
-                                "/wiki/" + d + ".json.gz"), true);
+                FieldDocument fd = ki.addDoc(getClass()
+                        .getResourceAsStream("/wiki/" + d + ".json.gz"), true);
             };
             ki.commit();
         };
@@ -321,21 +320,21 @@
     @Test
     public void checkBenchmark3 () throws IOException {
         Properties prop = new Properties();
-        InputStream fr = new FileInputStream(getClass().getResource(
-                "/krill.properties").getFile());
+        InputStream fr = new FileInputStream(
+                getClass().getResource("/krill.properties").getFile());
         prop.load(fr);
 
         // Get the real index
-        KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
-                .getProperty("krill.indexDir"))));
+        KrillIndex ki = new KrillIndex(new MMapDirectory(
+                Paths.get(prop.getProperty("krill.indexDir"))));
 
         // Create a container for virtual collections:
         KrillCollection kc = new KrillCollection(ki);
 
         long t1 = 0, t2 = 0;
         /// cosmas20.json!!!
-        String json = getString(getClass().getResource(
-                "/queries/benchmark3.jsonld").getFile());
+        String json = getString(
+                getClass().getResource("/queries/benchmark3.jsonld").getFile());
 
         int rounds = 500;
 
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java
index 27a3dd7..4207e6c 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java
@@ -88,14 +88,14 @@
     @Test
     public void builderTill () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals("pubDate:[0 TO 20059999]", kc.till("pubDate", "2005")
-                .toString());
+        assertEquals("pubDate:[0 TO 20059999]",
+                kc.till("pubDate", "2005").toString());
 
-        assertEquals("pubDate:[0 TO 20051299]", kc.till("pubDate", "2005-12")
-                .toString());
+        assertEquals("pubDate:[0 TO 20051299]",
+                kc.till("pubDate", "2005-12").toString());
 
-        assertEquals("pubDate:[0 TO 20051204]", kc
-                .till("pubDate", "2005-12-04").toString());
+        assertEquals("pubDate:[0 TO 20051204]",
+                kc.till("pubDate", "2005-12-04").toString());
     };
 
 
@@ -110,16 +110,15 @@
     @Test
     public void builderOrSimple () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals("author:tree", kc.orGroup()
-                .with(kc.term("author", "tree")).toString());
+        assertEquals("author:tree",
+                kc.orGroup().with(kc.term("author", "tree")).toString());
     };
 
 
     @Test
     public void builderAndCombined () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals(
-                "AndGroup(author:tree title:name)",
+        assertEquals("AndGroup(author:tree title:name)",
                 kc.andGroup().with(kc.term("author", "tree"))
                         .with(kc.term("title", "name")).toString());
     };
@@ -128,19 +127,16 @@
     @Test
     public void builderAndNestedSimple () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals(
-                "AndGroup(author:tree title:name)",
-                kc.andGroup()
-                        .with(kc.andGroup().with(kc.term("author", "tree"))
-                                .with(kc.term("title", "name"))).toString());
+        assertEquals("AndGroup(author:tree title:name)",
+                kc.andGroup().with(kc.andGroup().with(kc.term("author", "tree"))
+                        .with(kc.term("title", "name"))).toString());
     };
 
 
     @Test
     public void builderOrCombined () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals(
-                "OrGroup(author:tree title:name)",
+        assertEquals("OrGroup(author:tree title:name)",
                 kc.orGroup().with(kc.term("author", "tree"))
                         .with(kc.term("title", "name")).toString());
     };
@@ -149,23 +145,21 @@
     @Test
     public void builderOrNestedSimple () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        assertEquals(
-                "OrGroup(author:tree title:name)",
-                kc.orGroup()
-                        .with(kc.orGroup().with(kc.term("author", "tree"))
-                                .with(kc.term("title", "name"))).toString());
+        assertEquals("OrGroup(author:tree title:name)",
+                kc.orGroup().with(kc.orGroup().with(kc.term("author", "tree"))
+                        .with(kc.term("title", "name"))).toString());
     };
 
 
     @Test
     public void builderGroups () throws IOException {
         CollectionBuilder kc = new CollectionBuilder();
-        String g = kc
-                .orGroup()
+        String g = kc.orGroup()
                 .with(kc.orGroup().with(kc.term("author", "tree1"))
                         .with(kc.term("title", "name1")))
                 .with(kc.andGroup().with(kc.term("author", "tree2"))
-                        .with(kc.term("title", "name2"))).toString();
+                        .with(kc.term("title", "name2")))
+                .toString();
         assertEquals(
                 "OrGroup(OrGroup(author:tree1 title:name1) AndGroup(author:tree2 title:name2))",
                 g);
@@ -181,9 +175,8 @@
         assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
         assertFalse(kbi.isNegative());
 
-        kbi = kc.andGroup()
-                .with(kc.orGroup().with(kc.term("author", "tree1"))
-                        .with(kc.term("title", "name1"))).not();
+        kbi = kc.andGroup().with(kc.orGroup().with(kc.term("author", "tree1"))
+                .with(kc.term("title", "name1"))).not();
         assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
         assertTrue(kbi.isNegative());
     };
@@ -223,8 +216,7 @@
                 kf.and("textClass", "tree").and("textClass", "sport")
                         .toString());
         */
-        assertEquals(
-                "AndGroup(textClass:tree textClass:sport)",
+        assertEquals("AndGroup(textClass:tree textClass:sport)",
                 kf.andGroup().with(kf.term("textClass", "tree"))
                         .with(kf.term("textClass", "sport")).toString());
 
@@ -245,8 +237,7 @@
         assertEquals("+textClass:tree +textClass:sport +textClass:news", kf
                 .and("textClass", "tree", "sport", "news").toString());
         */
-        assertEquals(
-                "AndGroup(textClass:tree textClass:sport textClass:news)",
+        assertEquals("AndGroup(textClass:tree textClass:sport textClass:news)",
                 kf.andGroup().with("textClass", "tree")
                         .with("textClass", "sport").with("textClass", "news")
                         .toString());
@@ -255,9 +246,9 @@
         assertEquals("corpusID:c-1 corpusID:c-2 corpusID:c-3",
                 kf.or("corpusID", "c-1", "c-2", "c-3").toString());
         */
-        assertEquals("OrGroup(corpusID:c-1 corpusID:c-2 corpusID:c-3)", kf
-                .orGroup().with("corpusID", "c-1").with("corpusID", "c-2")
-                .with("corpusID", "c-3").toString());
+        assertEquals("OrGroup(corpusID:c-1 corpusID:c-2 corpusID:c-3)",
+                kf.orGroup().with("corpusID", "c-1").with("corpusID", "c-2")
+                        .with("corpusID", "c-3").toString());
 
     };
 
@@ -279,8 +270,8 @@
         assertEquals("+pubDate:[0 TO 20030604]", kf.till("2003-06-04")
                 .toString());
         */
-        assertEquals("pubDate:[0 TO 20030604]", kf
-                .till("pubDate", "2003-06-04").toString());
+        assertEquals("pubDate:[0 TO 20030604]",
+                kf.till("pubDate", "2003-06-04").toString());
 
 
         /*
@@ -345,40 +336,40 @@
         /*
         assertEquals("+pubDate:[0 TO 20059999]", kf.till("2005").toString());
         */
-        assertEquals("pubDate:[0 TO 20059999]", kf.till("pubDate", "2005")
-                .toString());
+        assertEquals("pubDate:[0 TO 20059999]",
+                kf.till("pubDate", "2005").toString());
 
         /*
         assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
         */
-        assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510")
-                .toString());
+        assertEquals("pubDate:[0 TO 20051099]",
+                kf.till("pubDate", "200510").toString());
 
         /*
         assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
         */
-        assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510")
-                .toString());
+        assertEquals("pubDate:[0 TO 20051099]",
+                kf.till("pubDate", "200510").toString());
 
         /*
         assertEquals("+pubDate:[0 TO 20051099]", kf.till("2005-10").toString());
         */
-        assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "2005-10")
-                .toString());
+        assertEquals("pubDate:[0 TO 20051099]",
+                kf.till("pubDate", "2005-10").toString());
 
         /*
         assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-1006")
                 .toString());
          */
-        assertEquals("pubDate:[0 TO 20051006]", kf.till("pubDate", "2005-1006")
-                .toString());
+        assertEquals("pubDate:[0 TO 20051006]",
+                kf.till("pubDate", "2005-1006").toString());
 
         /*
         assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-10-06")
                 .toString());
         */
-        assertEquals("pubDate:[0 TO 20051006]", kf
-                .till("pubDate", "2005-10-06").toString());
+        assertEquals("pubDate:[0 TO 20051006]",
+                kf.till("pubDate", "2005-10-06").toString());
 
         /*
         assertEquals("+pubDate:[20050000 TO 99999999]", kf.since("2005")
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
index 27071fa..787bf3f 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
@@ -348,8 +348,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
@@ -405,13 +404,11 @@
         assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
 
         // Create a query
-        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN")
-                .with("tt/p:NN"));
-        ks.setCollection(kc)
-                .getMeta()
-                .setStartIndex(0)
-                .setCount((short) 20)
-                .setContext(new SearchContext(true, (short) 5, true, (short) 5));
+        Krill ks = new Krill(
+                new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc).getMeta().setStartIndex(0).setCount((short) 20)
+                .setContext(
+                        new SearchContext(true, (short) 5, true, (short) 5));
 
         Result kr = ks.apply(ki);
 
@@ -444,8 +441,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
             ki.commit();
         };
@@ -497,13 +493,11 @@
         assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
 
         // Create a query
-        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN")
-                .with("tt/p:NN"));
-        ks.setCollection(kc)
-                .getMeta()
-                .setStartIndex(0)
-                .setCount((short) 20)
-                .setContext(new SearchContext(true, (short) 5, true, (short) 5));
+        Krill ks = new Krill(
+                new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc).getMeta().setStartIndex(0).setCount((short) 20)
+                .setContext(
+                        new SearchContext(true, (short) 5, true, (short) 5));
 
         Result kr = ks.apply(ki);
         /*
@@ -558,20 +552,20 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        ki.addDoc(getClass()
-                .getResourceAsStream("/wiki/00012-fakemeta.json.gz"), true);
+        ki.addDoc(
+                getClass().getResourceAsStream("/wiki/00012-fakemeta.json.gz"),
+                true);
 
         ki.commit();
 
         /*
         CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
-
+        
         // Create Virtual collections:
         KrillCollectionLegacy kc = new KrillCollectionLegacy(ki);
         kc.filter(kf.and("textClass", "reisen").and("textClass",
@@ -590,13 +584,11 @@
 
 
         // Create a query
-        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN")
-                .with("tt/p:NN"));
-        ks.setCollection(kc)
-                .getMeta()
-                .setStartIndex(0)
-                .setCount((short) 20)
-                .setContext(new SearchContext(true, (short) 5, true, (short) 5));
+        Krill ks = new Krill(
+                new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc).getMeta().setStartIndex(0).setCount((short) 20)
+                .setContext(
+                        new SearchContext(true, (short) 5, true, (short) 5));
 
         Result kr = ks.apply(ki);
 
@@ -658,11 +650,9 @@
 
 
         Krill ks = new Krill(sq);
-        ks.setCollection(kc)
-                .getMeta()
-                .setStartIndex(0)
-                .setCount((short) 20)
-                .setContext(new SearchContext(true, (short) 5, true, (short) 5));
+        ks.setCollection(kc).getMeta().setStartIndex(0).setCount((short) 20)
+                .setContext(
+                        new SearchContext(true, (short) 5, true, (short) 5));
         kr = ks.apply(ki);
 
         // kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
index 8b08bda..95f8073 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
@@ -66,8 +66,8 @@
         assertFalse(ks.hasErrors());
         assertFalse(ks.hasWarnings());
         assertFalse(ks.hasMessages());
-        assertEquals("QueryWrapperFilter(author:/Goethe/)", ks.getCollection()
-                .toString());
+        assertEquals("QueryWrapperFilter(author:/Goethe/)",
+                ks.getCollection().toString());
     };
 
 
@@ -78,8 +78,8 @@
         assertFalse(ks.hasErrors());
         assertFalse(ks.hasWarnings());
         assertFalse(ks.hasMessages());
-        assertEquals("-QueryWrapperFilter(author:/Goethe/)", ks.getCollection()
-                .toString());
+        assertEquals("-QueryWrapperFilter(author:/Goethe/)",
+                ks.getCollection().toString());
     };
 
 
@@ -112,8 +112,8 @@
         assertFalse(ks.hasErrors());
         assertFalse(ks.hasWarnings());
         assertFalse(ks.hasMessages());
-        assertEquals("QueryWrapperFilter(author:/Goe:th=e/)", ks
-                .getCollection().toString());
+        assertEquals("QueryWrapperFilter(author:/Goe:th=e/)",
+                ks.getCollection().toString());
     };
 
 
@@ -132,7 +132,8 @@
 
     @Test
     public void nocollectiontypegiven () {
-        String metaQuery = _getJSONString("multiterm_rewrite_collection.jsonld");
+        String metaQuery = _getJSONString(
+                "multiterm_rewrite_collection.jsonld");
         KrillCollection kc = new KrillCollection(metaQuery);
         assertEquals(701, kc.getError(0).getCode());
     };
@@ -154,8 +155,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
@@ -186,8 +186,8 @@
     // Legacy collections reflect old tests, that were adopted to the new scheme
     @Test
     public void metaQuery1Legacy () {
-        String metaQuery = getJsonString(getClass().getResource(
-                "/queries/metaquery.jsonld").getFile());
+        String metaQuery = getJsonString(
+                getClass().getResource("/queries/metaquery.jsonld").getFile());
         KrillCollection kc = new KrillCollection(metaQuery);
 
         /*
@@ -211,8 +211,8 @@
 
     @Test
     public void metaQuery2Legacy () {
-        String metaQuery = getJsonString(getClass().getResource(
-                "/queries/metaquery2.jsonld").getFile());
+        String metaQuery = getJsonString(
+                getClass().getResource("/queries/metaquery2.jsonld").getFile());
         KrillCollection kc = new KrillCollection(metaQuery);
         /*
         assertEquals(1, kc.getCount());
@@ -227,8 +227,8 @@
 
     @Test
     public void metaQuery3Legacy () {
-        String metaQuery = getJsonString(getClass().getResource(
-                "/queries/metaquery4.jsonld").getFile());
+        String metaQuery = getJsonString(
+                getClass().getResource("/queries/metaquery4.jsonld").getFile());
         KrillCollection kc = new KrillCollection(metaQuery);
         /*
         assertEquals(1, kc.getCount());
@@ -245,8 +245,8 @@
 
     @Test
     public void metaQuery7Legacy () {
-        String metaQuery = getJsonString(getClass().getResource(
-                "/queries/metaquery7.jsonld").getFile());
+        String metaQuery = getJsonString(
+                getClass().getResource("/queries/metaquery7.jsonld").getFile());
         KrillCollection kc = new KrillCollection(metaQuery);
         /*
         assertEquals(2, kc.getCount());
@@ -266,8 +266,8 @@
 
     @Test
     public void metaQuery9 () {
-        String metaQuery = getJsonString(getClass().getResource(
-                "/queries/metaquery9.jsonld").getFile());
+        String metaQuery = getJsonString(
+                getClass().getResource("/queries/metaquery9.jsonld").getFile());
         KrillCollection kc = new KrillCollection(metaQuery);
         /*
         assertEquals(1, kc.getCount());
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
index 2371d3d..4785667 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
@@ -30,8 +30,9 @@
     @Test
     public void queryJSONpoly1 () throws QueryException, IOException {
 
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/poly1.json")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/poly1.json").getFile(),
+                "UTF-8");
         String jsonQuery = readFile(jsonPath);
         SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(jsonQuery);
 
@@ -65,8 +66,9 @@
     @Test
     public void queryJSONpoly4 () throws QueryException, IOException {
 
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/poly4.json")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/poly4.json").getFile(),
+                "UTF-8");
         String jsonQuery = readFile(jsonPath);
         SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(jsonQuery);
         SpanQuery sq = sqwi.toQuery();
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
index 43c15eb..5507a89 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
@@ -43,8 +43,8 @@
 
 
         QueryBuilder kq = new QueryBuilder("tokens");
-        Result kr = ki.search((SpanQuery) kq.seq(kq._(1, kq.seg("s:b")))
-                .toQuery());
+        Result kr = ki
+                .search((SpanQuery) kq.seq(kq._(1, kq.seg("s:b"))).toQuery());
         Match km = kr.getMatch(0);
         assertEquals(km.getStartPos(), 1);
         assertEquals(km.getEndPos(), 2);
@@ -83,10 +83,14 @@
                 km.getSnippetHTML());
 
 
-        kr = ki.search((SpanQuery) kq._(
-                3,
-                kq.seq(kq._(1, kq.seq(kq.seg("s:a")).append(kq.seg("s:b"))))
-                        .append(kq._(2, kq.seg("s:c")))).toQuery());
+        kr = ki.search(
+                (SpanQuery) kq._(
+                        3, kq
+                                .seq(kq._(1,
+                                        kq.seq(kq.seg("s:a"))
+                                                .append(kq.seg("s:b"))))
+                                .append(kq._(2, kq.seg("s:c"))))
+                        .toQuery());
         km = kr.getMatch(0);
         assertEquals(km.getStartPos(), 0);
         assertEquals(km.getEndPos(), 3);
@@ -147,9 +151,9 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
         fd.addString("UID", "1");
-        fd.addTV("base", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("base", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
@@ -163,9 +167,9 @@
         fd = new FieldDocument();
         fd.addString("ID", "doc-3");
         fd.addString("UID", "3");
-        fd.addTV("base", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("base", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
 
         // Commit!
@@ -204,8 +208,8 @@
         assertEquals("ab[[{1:a}]]", kr.getMatch(13).getSnippetBrackets());
 
         kq = new QueryBuilder("base");
-        q = (SpanQuery) kq.or(kq._(1, kq.seg("i:a")))
-                .or(kq._(2, kq.seg("i:c"))).toQuery();
+        q = (SpanQuery) kq.or(kq._(1, kq.seg("i:a"))).or(kq._(2, kq.seg("i:c")))
+                .toQuery();
         Krill qs = new Krill(q);
         qs.getMeta().getContext().left.setToken(true).setLength((short) 1);
         qs.getMeta().getContext().right.setToken(true).setLength((short) 1);
@@ -239,8 +243,8 @@
         assertEquals("[[{1:a}]] ...", kr.getMatch(8).getSnippetBrackets());
         assertEquals("... [[{2:a}]]", kr.getMatch(9).getSnippetBrackets());
 
-        q = (SpanQuery) kq._(3,
-                kq.or(kq._(1, kq.seg("i:a"))).or(kq._(2, kq.seg("i:c"))))
+        q = (SpanQuery) kq
+                ._(3, kq.or(kq._(1, kq.seg("i:a"))).or(kq._(2, kq.seg("i:c"))))
                 .toQuery();
         qs = new Krill(q);
         qs.getMeta().getContext().left.setToken(true).setLength((short) 0);
@@ -249,14 +253,14 @@
         assertEquals((long) 10, kr.getTotalResults());
 
         assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(0).getSnippetBrackets());
-        assertEquals("... [[{3:{2:a}}]] ...", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("... [[{3:{2:a}}]] ...",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals("... [[{3:{1:b}}]]", kr.getMatch(2).getSnippetBrackets());
         assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(3).getSnippetBrackets());
         assertEquals("... [[{3:{2:a}}]]", kr.getMatch(4).getSnippetBrackets());
         assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(5).getSnippetBrackets());
-        assertEquals("... [[{3:{2:a}}]] ...", kr.getMatch(6)
-                .getSnippetBrackets());
+        assertEquals("... [[{3:{2:a}}]] ...",
+                kr.getMatch(6).getSnippetBrackets());
         assertEquals("... [[{3:{1:b}}]]", kr.getMatch(7).getSnippetBrackets());
         assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(8).getSnippetBrackets());
         assertEquals("... [[{3:{2:a}}]]", kr.getMatch(9).getSnippetBrackets());
@@ -270,30 +274,29 @@
         KrillIndex ki = new KrillIndex();
         // Indexing test files
         for (String i : new String[] { "00001", "00002" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
         // 15
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/greater_highlights_15.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/greater_highlights_15.jsonld")
+                .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
         assertEquals(kr.getSerialQuery(), "{15: tokens:s:Alphabet}");
         assertEquals(kr.getTotalResults(), 7);
         assertEquals(kr.getStartIndex(), 0);
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... 2. Herkunft Die aus dem proto-semitischen [[{15:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(
-                kr.getMatch(0).getSnippetHTML(),
+        assertEquals(kr.getMatch(0).getSnippetHTML(),
                 "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-15 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/greater_highlights_16.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/greater_highlights_16.jsonld")
+                .getFile());
 
         // 16
         ks = new Krill(json);
@@ -301,54 +304,51 @@
         assertEquals(kr.getSerialQuery(), "{16: tokens:s:Alphabet}");
         assertEquals(kr.getTotalResults(), 7);
         assertEquals(kr.getStartIndex(), 0);
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... 2. Herkunft Die aus dem proto-semitischen [[{16:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(
-                kr.getMatch(0).getSnippetHTML(),
+        assertEquals(kr.getMatch(0).getSnippetHTML(),
                 "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-16 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 127
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/greater_highlights_127.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/greater_highlights_127.jsonld")
+                .getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(kr.getSerialQuery(), "{127: tokens:s:Alphabet}");
         assertEquals(kr.getTotalResults(), 7);
         assertEquals(kr.getStartIndex(), 0);
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... 2. Herkunft Die aus dem proto-semitischen [[{127:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(
-                kr.getMatch(0).getSnippetHTML(),
+        assertEquals(kr.getMatch(0).getSnippetHTML(),
                 "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-127 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 255
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/greater_highlights_255.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/greater_highlights_255.jsonld")
+                .getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(kr.getSerialQuery(), "{255: tokens:s:Alphabet}");
         assertEquals(kr.getTotalResults(), 7);
         assertEquals(kr.getStartIndex(), 0);
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... 2. Herkunft Die aus dem proto-semitischen [[Alphabet]] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(
-                kr.getMatch(0).getSnippetHTML(),
+        assertEquals(kr.getMatch(0).getSnippetHTML(),
                 "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark>Alphabet</mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 300
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/greater_highlights_300.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/greater_highlights_300.jsonld")
+                .getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(709, kr.getError(0).getCode());
-        assertEquals("Valid class numbers exceeded", kr.getError(0)
-                .getMessage());
+        assertEquals("Valid class numbers exceeded",
+                kr.getError(0).getMessage());
 
         assertEquals(kr.getError(0).getMessage(),
                 "Valid class numbers exceeded");
@@ -365,9 +365,7 @@
 
         // Make this clean for HTML and Brackets!
 
-        fd.addTV(
-                "base",
-                "Mit \"Mann\" & {Ma\\us}",
+        fd.addTV("base", "Mit \"Mann\" & {Ma\\us}",
                 "[(0-3)s:Mit|i:mit|_0#0-3|-:t$<i>4|<>:base/t:t$<b>64<i>0<i>20<i>4<b>0]"
                         + "[(4-10)s:\"Mann\"|i:\"mann\"|base/l:\"Mann\"|_1#4-10]"
                         + "[(11-12)s:&|i:&|base/l:&|_2#11-12]"
@@ -385,8 +383,8 @@
 
         Result kr = ki.search(qs);
         assertEquals((long) 1, kr.getTotalResults());
-        assertEquals("[[Mit \"Mann\" & \\{Ma\\\\us\\}]]", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("[[Mit \"Mann\" & \\{Ma\\\\us\\}]]",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals(
                 "<span class=\"context-left\"></span><span class=\"match\"><mark>Mit &quot;Mann&quot; &amp; {Ma\\us}</mark></span><span class=\"context-right\"></span>",
                 kr.getMatch(0).getSnippetHTML());
@@ -395,12 +393,14 @@
         Match km = ki.getMatchInfo("match-c1/d1/1-p0-4", "base", true,
                 (ArrayList) null, (ArrayList) null, true, true, false);
         assertEquals(0, km.getStartPos());
-        assertEquals("<span class=\"context-left\"></span>"
-                + "<span class=\"match\"><mark><span title=\"base/t:t\">"
-                + "Mit " + "<span title=\"base/l:&quot;Mann&quot;\">"
-                + "&quot;Mann&quot;" + "</span>" + " "
-                + "<span title=\"base/l:&amp;\">&amp;</span>" + " "
-                + "{Ma\\us}" + "</span>" + "</mark></span>"
-                + "<span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals(
+                "<span class=\"context-left\"></span>"
+                        + "<span class=\"match\"><mark><span title=\"base/t:t\">"
+                        + "Mit " + "<span title=\"base/l:&quot;Mann&quot;\">"
+                        + "&quot;Mann&quot;" + "</span>" + " "
+                        + "<span title=\"base/l:&amp;\">&amp;</span>" + " "
+                        + "{Ma\\us}" + "</span>" + "</mark></span>"
+                        + "<span class=\"context-right\"></span>",
+                km.getSnippetHTML());
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
index 8d7027f..3fc9ea5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
@@ -33,38 +33,32 @@
     private FieldDocument createFieldDoc0 () {
         fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV(
-                "base",
-                "bcbabd",
-                "[(0-1)s:a|_1$<i>0<i>1|"
-                        + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>3|"
-                        + "<>:div$<b>64<i>0<i>2<i>2<b>0<s>2|"
-                        + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
-                        + "@:class=header$<b>17<i>3<s>1|@:class=header$<b>17<i>2<s>2]"
+        fd.addTV("base", "bcbabd", "[(0-1)s:a|_1$<i>0<i>1|"
+                + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>3|"
+                + "<>:div$<b>64<i>0<i>2<i>2<b>0<s>2|"
+                + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
+                + "@:class=header$<b>17<i>3<s>1|@:class=header$<b>17<i>2<s>2]"
 
-                        + "[(1-2)s:e|_2$<i>1<i>2|"
-                        + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>1|@:class=header$<b>17<i>2<s>1]"
+                + "[(1-2)s:e|_2$<i>1<i>2|"
+                + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>1|@:class=header$<b>17<i>2<s>1]"
 
-                        + "[(2-3)s:e|_3$<i>2<i>3|"
-                        + "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=time$<b>17<i>5<s>1]"
+                + "[(2-3)s:e|_3$<i>2<i>3|"
+                + "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=time$<b>17<i>5<s>1]"
 
-                        + "[(3-4)s:a|_4$<i>3<i>4|"
-                        + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1]"
+                + "[(3-4)s:a|_4$<i>3<i>4|"
+                + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1]"
 
-                        + "[(4-5)s:b|_5$<i>4<i>5|"
-                        + "<>:a$<b>64<i>4<i>5<i>5<b>0<s>2|"
-                        + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
-                        + "@:class=header$<b>17<i>5<s>2]"
+                + "[(4-5)s:b|_5$<i>4<i>5|" + "<>:a$<b>64<i>4<i>5<i>5<b>0<s>2|"
+                + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
+                + "@:class=header$<b>17<i>5<s>2]"
 
-                        + "[(5-6)s:d|_6$<i>5<i>6|"
-                        + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>2|"
-                        + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
-                        + "@:class=header$<b>17<i>6<s>1]"
+                + "[(5-6)s:d|_6$<i>5<i>6|" + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>2|"
+                + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
+                + "@:class=header$<b>17<i>6<s>1]"
 
-                        + "[(6-7)s:d|_7$<i>6<i>7|"
-                        + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
-                        + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1"
-                        + "|@:class=header$<b>17<i>7<s>1|@:class=header$<b>17<i>7<s>2]");
+                + "[(6-7)s:d|_7$<i>6<i>7|" + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+                + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1"
+                + "|@:class=header$<b>17<i>7<s>1|@:class=header$<b>17<i>7<s>2]");
 
         return fd;
     }
@@ -73,36 +67,29 @@
     private FieldDocument createFieldDoc1 () {
         fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "base",
-                "bcbabd",
-                "[(0-1)s:b|_1$<i>0<i>1|"
-                        + "<>:s<b>64<i>0<i>5<i>5<b>0<s>2|"
-                        + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
-                        + "@:class=header$<b>17<i>3<s>1|@:class=title$<b>17<i>3<s>1|@:class=book$<b>17<i>3<s>1]"
+        fd.addTV("base", "bcbabd", "[(0-1)s:b|_1$<i>0<i>1|"
+                + "<>:s<b>64<i>0<i>5<i>5<b>0<s>2|"
+                + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
+                + "@:class=header$<b>17<i>3<s>1|@:class=title$<b>17<i>3<s>1|@:class=book$<b>17<i>3<s>1]"
 
-                        + "[(1-2)s:c|_2$<i>1<i>2|"
-                        + "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
-                        + "@:class=header$<b>17<i>2<s>1|@:class=title$<b>17<i>2<s>1]"
+                + "[(1-2)s:c|_2$<i>1<i>2|" + "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
+                + "@:class=header$<b>17<i>2<s>1|@:class=title$<b>17<i>2<s>1]"
 
-                        + "[(2-3)s:b|_3$<i>2<i>3|"
-                        + "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=book$<b>17<i>5<s>1]"
+                + "[(2-3)s:b|_3$<i>2<i>3|"
+                + "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=book$<b>17<i>5<s>1]"
 
-                        + "[(3-4)s:a|_4$<i>3<i>4|"
-                        + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
+                + "[(3-4)s:a|_4$<i>3<i>4|"
+                + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
 
-                        + "[(4-5)s:b|_5$<i>4<i>5|"
-                        + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
-                        + "@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1|@:class=title$<b>17<i>5<s>1]"
+                + "[(4-5)s:b|_5$<i>4<i>5|" + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
+                + "@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1|@:class=title$<b>17<i>5<s>1]"
 
-                        + "[(5-6)s:d|_6$<i>5<i>6|"
-                        + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>2|"
-                        + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
+                + "[(5-6)s:d|_6$<i>5<i>6|" + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>2|"
+                + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
 
-                        + "[(6-7)s:d|_7$<i>6<i>7|"
-                        + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
-                        + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
-                        + "@:class=header$<b>17<i>7<s>1|@:class=title$<b>17<i>7<s>1]");
+                + "[(6-7)s:d|_7$<i>6<i>7|" + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+                + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
+                + "@:class=header$<b>17<i>7<s>1|@:class=title$<b>17<i>7<s>1]");
 
         return fd;
     }
@@ -111,38 +98,31 @@
     private FieldDocument createFieldDoc2 () {
         fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "base",
-                "bcbabd",
-                "[(0-1)s:b|_1$<i>0<i>1|"
-                        + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>2|"
-                        + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>1|"
-                        + "@:class=header$<b>17<i>3<s>2|@:class=book$<b>17<i>5<s>1|@:class=book$<b>17<i>3<s>2]"
+        fd.addTV("base", "bcbabd", "[(0-1)s:b|_1$<i>0<i>1|"
+                + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>2|"
+                + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>1|"
+                + "@:class=header$<b>17<i>3<s>2|@:class=book$<b>17<i>5<s>1|@:class=book$<b>17<i>3<s>2]"
 
-                        + "[(1-2)s:e|_2$<i>1<i>2|"
-                        + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
-                        + "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
-                        + "@:class=book$<b>17<i>2<s>2|@:class=header$<b>17<i>2<s>1]"
+                + "[(1-2)s:e|_2$<i>1<i>2|" + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+                + "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
+                + "@:class=book$<b>17<i>2<s>2|@:class=header$<b>17<i>2<s>1]"
 
-                        + "[(2-3)s:b|_3$<i>2<i>3|"
-                        + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
-                        + "<>:div$<b>64<i>2<i>3<i>5<b>0<s>1|"
-                        + "@:class=header$<b>17<i>2<s>2|@:class=book$<b>17<i>5<s>1]"
+                + "[(2-3)s:b|_3$<i>2<i>3|" + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+                + "<>:div$<b>64<i>2<i>3<i>5<b>0<s>1|"
+                + "@:class=header$<b>17<i>2<s>2|@:class=book$<b>17<i>5<s>1]"
 
-                        + "[(3-4)s:a|_4$<i>3<i>4|"
-                        + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
+                + "[(3-4)s:a|_4$<i>3<i>4|"
+                + "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
 
-                        + "[(4-5)s:b|_5$<i>4<i>5|"
-                        + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1]"
+                + "[(4-5)s:b|_5$<i>4<i>5|"
+                + "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1]"
 
-                        + "[(5-6)s:d|_6$<i>5<i>6|"
-                        + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
-                        + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
+                + "[(5-6)s:d|_6$<i>5<i>6|" + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
+                + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
 
-                        + "[(6-7)s:d|_7$<i>6<i>7|"
-                        + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
-                        + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
-                        + "@:class=header$<b>17<i>7<s>1|@:class=book$<b>17<i>7<s>2]");
+                + "[(6-7)s:d|_7$<i>6<i>7|" + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+                + "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
+                + "@:class=header$<b>17<i>7<s>1|@:class=book$<b>17<i>7<s>2]");
 
         return fd;
     }
@@ -152,14 +132,14 @@
      * Test matching elementRef
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki.addDoc(createFieldDoc0());
         ki.commit();
 
-        SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:class=header")), true);
+        SpanAttributeQuery saq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true);
 
         SpanElementQuery seq = new SpanElementQuery("base", "div");
 
@@ -189,20 +169,20 @@
      * Test multiple attributes and negation
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki.addDoc(createFieldDoc1());
         ki.commit();
         // header and title
         List<SpanQuery> sql = new ArrayList<>();
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true));
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=title")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=title")), true));
 
-        SpanQuery sq = new SpanWithAttributeQuery(new SpanElementQuery("base",
-                "div"), sql, true);
+        SpanQuery sq = new SpanWithAttributeQuery(
+                new SpanElementQuery("base", "div"), sql, true);
 
         kr = ki.search(sq, (short) 10);
 
@@ -218,8 +198,9 @@
 
         // Add not Attribute
         // header and title, not book
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=book")), true, true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true,
+                true));
 
         sq = new SpanWithAttributeQuery(new SpanElementQuery("base", "div"),
                 sql, true);
@@ -235,8 +216,9 @@
         // Test multiple negations
         // header, not title, not book
         sql.remove(1);
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=title")), true, true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=title")), true,
+                true));
 
         sq = new SpanWithAttributeQuery(new SpanElementQuery("base", "div"),
                 sql, true);
@@ -252,17 +234,18 @@
      * Element with only not attributes
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testcase9 () throws IOException {
 
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:class=book")), true, true);
-        SpanQuery sq = new SpanWithAttributeQuery(new SpanElementQuery("base",
-                "div"), saq, true);
+        SpanAttributeQuery saq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true,
+                true);
+        SpanQuery sq = new SpanWithAttributeQuery(
+                new SpanElementQuery("base", "div"), saq, true);
 
         kr = ki.search(sq, (short) 10);
         assertEquals(4, kr.getTotalResults());
@@ -277,8 +260,9 @@
 
         List<SpanQuery> sql = new ArrayList<>();
         sql.add(saq);
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true, true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true,
+                true));
         sq = new SpanWithAttributeQuery(new SpanElementQuery("base", "div"),
                 sql, true);
 
@@ -293,19 +277,20 @@
 
     /**
      * same attribute types referring to different element types
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         List<SpanQuery> sql = new ArrayList<>();
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true));
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=book")), true, true));
-        SpanQuery sq = new SpanWithAttributeQuery(new SpanElementQuery("base",
-                "div"), sql, true);
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true,
+                true));
+        SpanQuery sq = new SpanWithAttributeQuery(
+                new SpanElementQuery("base", "div"), sql, true);
 
         kr = ki.search(sq, (short) 10);
 
@@ -327,8 +312,8 @@
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:class=book")), true);
+        SpanAttributeQuery saq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true);
 
         List<SpanQuery> sql = new ArrayList<>();
         sql.add(saq);
@@ -345,8 +330,8 @@
 
         assertEquals((long) 6, kr.getTotalResults());
 
-        SpanNextQuery snq = new SpanNextQuery(new SpanTermQuery(new Term(
-                "base", "s:e")), sq);
+        SpanNextQuery snq = new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:e")), sq);
 
         kr = ki.search(snq, (short) 10);
 
@@ -359,13 +344,13 @@
 
     /**
      * Arbitrary elements with a specific attribute.
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
-        SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:class=book")), true);
+        SpanAttributeQuery saq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true);
 
         SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(saq, true);
         kr = ki.search(swaq, (short) 10);
@@ -388,17 +373,17 @@
 
     /**
      * Arbitrary elements with multiple attributes.
-     * */
+     */
     @Test
     public void testCase6 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         List<SpanQuery> sql = new ArrayList<>();
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true));
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=book")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true));
 
         SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sql, true);
         kr = ki.search(swaq, (short) 10);
@@ -414,17 +399,18 @@
 
     /**
      * Arbitrary elements with an attribute and a not attribute.
-     * */
+     */
     @Test
     public void testCase7 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         List<SpanQuery> sql = new ArrayList<>();
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true, true));
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=book")), true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true,
+                true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true));
 
         SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sql, true);
         kr = ki.search(swaq, (short) 10);
@@ -448,17 +434,19 @@
 
     /**
      * Arbitrary elements with only not attributes.
-     * */
+     */
     @Test(expected = IllegalArgumentException.class)
     public void testCase8 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         List<SpanQuery> sql = new ArrayList<>();
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=header")), true, true));
-        sql.add(new SpanAttributeQuery(new SpanTermQuery(new Term("base",
-                "@:class=book")), true, true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=header")), true,
+                true));
+        sql.add(new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:class=book")), true,
+                true));
 
         SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sql, true);
         kr = ki.search(swaq, (short) 10);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
index 8536540..2496df7 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
@@ -57,16 +57,16 @@
         assertEquals(18, kr.getMatch(1).getEndPos());
         assertEquals(
                 "Frankenstein, treat my daughter well. She [[{2:is {1:the one} that saved "
-                        + "your master who you hold so dear}]].", kr
-                        .getMatch(1).getSnippetBrackets());
+                        + "your master who you hold so dear}]].",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals(
                 "Frankenstein, treat my daughter well. She [[{2:is {1:the one that "
-                        + "saved your master who you hold so dear}}]].", kr
-                        .getMatch(2).getSnippetBrackets());
+                        + "saved your master who you hold so dear}}]].",
+                kr.getMatch(2).getSnippetBrackets());
         assertEquals(
                 "Frankenstein, treat my daughter well. She [[{2:is the one that "
-                        + "saved {1:your master} who you hold so dear}]].", kr
-                        .getMatch(3).getSnippetBrackets());
+                        + "saved {1:your master} who you hold so dear}]].",
+                kr.getMatch(3).getSnippetBrackets());
         assertEquals(
                 "Frankenstein, treat my daughter well. She [[{2:is the one that saved your master who {1:you} hold so dear}]].",
                 kr.getMatch(4).getSnippetBrackets());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
index d9f1acf..b3e0301 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
@@ -47,13 +47,13 @@
         assertEquals("totalResults", kr.getTotalResults(), 1);
         assertEquals("StartPos (0)", 7, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "... bcabca[[ba]]c", kr.getMatch(0)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetBrackets (0)", "... bcabca[[ba]]c",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\"><span class=\"more\">"
                         + "</span>bcabca</span><span class=\"match\"><mark>ba</mark></span><span class=\"context-right"
-                        + "\">c</span>", kr.getMatch(0).getSnippetHTML());
+                        + "\">c</span>",
+                kr.getMatch(0).getSnippetHTML());
 
         sq = new SpanTermQuery(new Term("base", "s:b"));
         kr = ki.search(sq, (short) 10);
@@ -61,24 +61,23 @@
         assertEquals("totalResults", kr.getTotalResults(), 3);
         assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "a[[b]]cabcab ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "a[[b]]cabcab ...",
+                kr.getMatch(0).getSnippetBrackets());
 
 
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\">a</span><span class=\"match\"><mark>"
                         + "b</mark></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
 
         assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abca[[b]]cabac", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abca[[b]]cabac",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
         assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
-        assertEquals("SnippetBrackets (2)", "... bcabca[[b]]ac", kr.getMatch(2)
-                .getSnippetBrackets());
+        assertEquals("SnippetBrackets (2)", "... bcabca[[b]]ac",
+                kr.getMatch(2).getSnippetBrackets());
 
         sq = new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")));
         kr = ki.search(sq, (short) 10);
@@ -86,24 +85,23 @@
         assertEquals("totalResults", kr.getTotalResults(), 3);
         assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
-        assertEquals("snippetBrackets (0)", "a[[{1:b}]]cabcab ...", kr
-                .getMatch(0).getSnippetBrackets());
-        assertEquals(
-                "snippetHTML (0)",
+        assertEquals("snippetBrackets (0)", "a[[{1:b}]]cabcab ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("snippetHTML (0)",
                 "<span class=\"context-left\">a</span><span class=\"match\"><mark>"
                         + "<mark class=\"class-1 level-0\">b</mark></mark></span><span class=\"context-right\">cabcab<span "
-                        + "class=\"more\"></span></span>", kr.getMatch(0)
-                        .getSnippetHTML());
+                        + "class=\"more\"></span></span>",
+                kr.getMatch(0).getSnippetHTML());
 
         assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
-        assertEquals("snippetBrackets (1)", "abca[[{1:b}]]cabac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("snippetBrackets (1)", "abca[[{1:b}]]cabac",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
         assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
-        assertEquals("snippetBrackets (2)", "... bcabca[[{1:b}]]ac", kr
-                .getMatch(2).getSnippetBrackets());
+        assertEquals("snippetBrackets (2)", "... bcabca[[{1:b}]]ac",
+                kr.getMatch(2).getSnippetBrackets());
 
 
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:a")),
@@ -115,87 +113,89 @@
         assertEquals("totalResults", kr.getTotalResults(), 3);
         assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "[[a{1:b}]]cabcab ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "[[a{1:b}]]cabcab ...",
+                kr.getMatch(0).getSnippetBrackets());
 
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\"></span><span class=\"match\"><mark>a<mark class=\"class-1 level-0\">b</mark></mark></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
 
         assertEquals("StartPos (1)", 3, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abc[[a{1:b}]]cabac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abc[[a{1:b}]]cabac",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals("StartPos (2)", 6, kr.getMatch(2).startPos);
         assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
-        assertEquals("SnippetBrackets (2)", "abcabc[[a{1:b}]]ac", kr
-                .getMatch(2).getSnippetBrackets());
+        assertEquals("SnippetBrackets (2)", "abcabc[[a{1:b}]]ac",
+                kr.getMatch(2).getSnippetBrackets());
 
 
         // abcabcabac
-        sq = new SpanNextQuery(new SpanClassQuery(new SpanTermQuery(new Term(
-                "base", "s:a")), (byte) 2), new SpanClassQuery(
-                new SpanTermQuery(new Term("base", "s:b")), (byte) 3));
+        sq = new SpanNextQuery(
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:a")),
+                        (byte) 2),
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
+                        (byte) 3));
 
         kr = ki.search(sq, (short) 10);
 
         assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "[[{2:a}{3:b}]]cabcab ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "[[{2:a}{3:b}]]cabcab ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("StartPos (1)", 3, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abc[[{2:a}{3:b}]]cabac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abc[[{2:a}{3:b}]]cabac",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals("StartPos (2)", 6, kr.getMatch(2).startPos);
         assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
-        assertEquals("SnippetBrackets (2)", "abcabc[[{2:a}{3:b}]]ac", kr
-                .getMatch(2).getSnippetBrackets());
+        assertEquals("SnippetBrackets (2)", "abcabc[[{2:a}{3:b}]]ac",
+                kr.getMatch(2).getSnippetBrackets());
 
         // abcabcabac
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:a")),
-                new SpanClassQuery(new SpanNextQuery(new SpanTermQuery(
-                        new Term("base", "s:b")), new SpanClassQuery(
-                        new SpanTermQuery(new Term("base", "s:a")))), (byte) 2));
+                new SpanClassQuery(new SpanNextQuery(
+                        new SpanTermQuery(new Term("base", "s:b")),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:a")))),
+                        (byte) 2));
 
         kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "abcabc[[a{2:b{1:a}}]]c", kr
-                .getMatch(0).getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetBrackets (0)", "abcabc[[a{2:b{1:a}}]]c",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\">abcabc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
                 kr.getMatch(0).getSnippetHTML());
 
         // Offset tokens
         kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c", kr
-                .getMatch(0).getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
                 kr.getMatch(0).getSnippetHTML());
 
         // Offset Characters
         kr = ki.search(sq, 0, (short) 10, false, (short) 2, false, (short) 2);
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c", kr
-                .getMatch(0).getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
                 kr.getMatch(0).getSnippetHTML());
 
 
         // System.err.println(kr.toJSON());
 
-        sq = new SpanNextQuery(new SpanClassQuery(new SpanTermQuery(new Term(
-                "base", "s:b")), (byte) 1), new SpanClassQuery(
-                new SpanTermQuery(new Term("base", "s:c")), (byte) 2));
+        sq = new SpanNextQuery(
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
+                        (byte) 1),
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:c")),
+                        (byte) 2));
 
         kr = ki.search(sq, (short) 10);
 
@@ -210,9 +210,9 @@
 
 
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:a")),
-                new SpanClassQuery(new SpanNextQuery(new SpanTermQuery(
-                        new Term("base", "s:b")), new SpanTermQuery(new Term(
-                        "base", "s:c")))));
+                new SpanClassQuery(new SpanNextQuery(
+                        new SpanTermQuery(new Term("base", "s:b")),
+                        new SpanTermQuery(new Term("base", "s:c")))));
 
         kr = ki.search(sq, (short) 2);
 
@@ -238,7 +238,8 @@
                 + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7]"
                 + "[(4-5)s:b|i:b|_4$<i>4<i>5]" + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
                 + "[(6-7)s:a|i:a|_6$<i>6<i>7]" + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
-                + "[(8-9)s:a|i:a|_8$<i>8<i>9]" + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
+                + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+                + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
         ki.addDoc(fd);
 
         ki.commit();
@@ -264,7 +265,7 @@
         kr = ki.search(sq, (short) 10);
         assertEquals("abc[abcab}ac]", kr.getMatch(0).getSnippetBrackets());
         System.err.println();
-
+        
         */
 
         /*
@@ -274,12 +275,12 @@
                   new SpanTermQuery(new Term("base", "s:a"))
                 )
             );
-
+        
                //	       new SpanTermQuery(new Term("base", "s:a")),
             //            new SpanClassQuery(
             //            )
             //        );
-
+        
         */
 
     }
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestDistanceExclusionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestDistanceExclusionIndex.java
index dbc3b72..0ef4ae5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestDistanceExclusionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestDistanceExclusionIndex.java
@@ -24,7 +24,7 @@
 
     /**
      * Ordered, unordered
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki = new KrillIndex();
@@ -52,7 +52,7 @@
     /**
      * Multiple docs, unordered
      * No more secondSpans
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki = new KrillIndex();
@@ -71,7 +71,7 @@
     /**
      * Secondspans' document number is bigger than firstspans'
      * Actual distance is smaller than min distance.
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki = new KrillIndex();
@@ -90,7 +90,7 @@
     /**
      * Unordered: firstspan in on the right side of the secondspan,
      * but within max distance.
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         ki = new KrillIndex();
@@ -109,7 +109,7 @@
 
     /**
      * Element queries
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         ki = new KrillIndex();
@@ -118,8 +118,8 @@
 
         SpanDistanceQuery sq;
         sq = new SpanDistanceQuery(new SpanElementQuery("base", "x"),
-                new SpanElementQuery("base", "y"), new DistanceConstraint(0, 1,
-                        false, true), true);
+                new SpanElementQuery("base", "y"),
+                new DistanceConstraint(0, 1, false, true), true);
 
         kr = ki.search(sq, (short) 10);
 
@@ -168,8 +168,9 @@
 
     private SpanQuery createQuery (String x, String y, int min, int max,
             boolean isOrdered) {
-        SpanDistanceQuery sq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("base", x)), new SpanTermQuery(new Term("base", y)),
+        SpanDistanceQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("base", x)),
+                new SpanTermQuery(new Term("base", y)),
                 new DistanceConstraint(min, max, isOrdered, true), true);
         return sq;
     }
@@ -195,10 +196,10 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV("base", "text", "[(0-1)s:b|s:c|_1$<i>0<i>1]"
-                + "[(1-2)s:b|_2$<i>1<i>2]" + "[(2-3)s:c|_3$<i>2<i>3]"
-                + "[(3-4)s:c|_4$<i>3<i>4]" + "[(4-5)s:d|_5$<i>4<i>5]"
-                + "[(5-6)s:d|_6$<i>5<i>6]");
+        fd.addTV("base", "text",
+                "[(0-1)s:b|s:c|_1$<i>0<i>1]" + "[(1-2)s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3]" + "[(3-4)s:c|_4$<i>3<i>4]"
+                        + "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:d|_6$<i>5<i>6]");
         return fd;
     }
 
@@ -206,12 +207,13 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("base", "text", "[(0-1)s:b|_1$<i>0<i>1]"
-                + "[(1-2)s:b|_2$<i>1<i>2]" + "[(2-3)s:c|_3$<i>2<i>3]"
-                + "[(3-4)s:c|_4$<i>3<i>4]" + "[(4-5)s:b|_5$<i>4<i>5]"
-                + "[(5-6)s:d|_6$<i>5<i>6]" + "[(6-7)s:b|_7$<i>6<i>7]"
-                + "[(7-8)s:d|_8$<i>7<i>8]" + "[(8-9)s:c|_9$<i>8<i>9]"
-                + "[(9-10)s:d|_10$<i>9<i>10]");
+        fd.addTV("base", "text",
+                "[(0-1)s:b|_1$<i>0<i>1]" + "[(1-2)s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3]" + "[(3-4)s:c|_4$<i>3<i>4]"
+                        + "[(4-5)s:b|_5$<i>4<i>5]" + "[(5-6)s:d|_6$<i>5<i>6]"
+                        + "[(6-7)s:b|_7$<i>6<i>7]" + "[(7-8)s:d|_8$<i>7<i>8]"
+                        + "[(8-9)s:c|_9$<i>8<i>9]"
+                        + "[(9-10)s:d|_10$<i>9<i>10]");
         return fd;
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestDistanceIndex.java
index 39d2392..a425578 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestDistanceIndex.java
@@ -27,10 +27,10 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("base", "text", "[(0-1)s:b|s:c|_1$<i>0<i>1]"
-                + "[(1-2)s:b|_2$<i>1<i>2]" + "[(2-3)s:c|_3$<i>2<i>3]"
-                + "[(3-4)s:c|_4$<i>3<i>4]" + "[(4-5)s:d|_5$<i>4<i>5]"
-                + "[(5-6)s:d|_6$<i>5<i>6]");
+        fd.addTV("base", "text",
+                "[(0-1)s:b|s:c|_1$<i>0<i>1]" + "[(1-2)s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3]" + "[(3-4)s:c|_4$<i>3<i>4]"
+                        + "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:d|_6$<i>5<i>6]");
         return fd;
     }
 
@@ -38,16 +38,16 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV("base", "text", "[(0-1)s:c|_1$<i>0<i>1]"
-                + "[(1-2)s:e|_2$<i>1<i>2]"
-                + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
-                + "[(3-4)s:c|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
-                + "[(4-5)s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
-                + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8<b>0]"
-                + "[(6-7)s:d|_7$<i>6<i>7]"
-                + "[(7-8)s:e|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
-                + "[(8-9)s:e|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
-                + "[(9-10)s:d|_10$<i>9<i>10]");
+        fd.addTV("base", "text",
+                "[(0-1)s:c|_1$<i>0<i>1]" + "[(1-2)s:e|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
+                        + "[(3-4)s:c|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
+                        + "[(4-5)s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
+                        + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8<b>0]"
+                        + "[(6-7)s:d|_7$<i>6<i>7]"
+                        + "[(7-8)s:e|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
+                        + "[(8-9)s:e|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
+                        + "[(9-10)s:d|_10$<i>9<i>10]");
         return fd;
     }
 
@@ -55,18 +55,19 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("base", "text", "[(0-1)s:b|_1$<i>0<i>1]"
-                + "[(1-2)s:b|_2$<i>1<i>2]" + "[(2-3)s:d|_3$<i>2<i>3]"
-                + "[(3-4)s:e|_4$<i>3<i>4]" + "[(4-5)s:d|_5$<i>4<i>5]"
-                + "[(5-6)s:e|_6$<i>5<i>6]");
+        fd.addTV("base", "text",
+                "[(0-1)s:b|_1$<i>0<i>1]" + "[(1-2)s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:d|_3$<i>2<i>3]" + "[(3-4)s:e|_4$<i>3<i>4]"
+                        + "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:e|_6$<i>5<i>6]");
         return fd;
     }
 
 
     private SpanQuery createQuery (String x, String y, int min, int max,
             boolean isOrdered) {
-        SpanQuery sq = new SpanDistanceQuery(new SpanTermQuery(new Term("base",
-                x)), new SpanTermQuery(new Term("base", y)),
+        SpanQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("base", x)),
+                new SpanTermQuery(new Term("base", y)),
                 new DistanceConstraint(min, max, isOrdered, false), true);
         return sq;
     }
@@ -75,8 +76,8 @@
     private SpanQuery createElementQuery (String x, String y, int min, int max,
             boolean isOrdered) {
         SpanQuery sq = new SpanDistanceQuery(new SpanElementQuery("base", x),
-                new SpanElementQuery("base", y), new DistanceConstraint(min,
-                        max, isOrdered, false), true);
+                new SpanElementQuery("base", y),
+                new DistanceConstraint(min, max, isOrdered, false), true);
         return sq;
     }
 
@@ -85,7 +86,7 @@
      * - Intersection
      * - Multiple occurrences in the same doc
      * - hasMoreFirstSpans = false for the current secondspan
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki = new KrillIndex();
@@ -128,7 +129,7 @@
      * from
      * the current secondspan
      * - Add new candidates
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki = new KrillIndex();
@@ -162,7 +163,7 @@
     /**
      * - Ensure the same document
      * - Multiple matches in multiple documents and atomic indices
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki = new KrillIndex();
@@ -185,7 +186,7 @@
      * still a secondspans in the same doc
      * - hasMoreFirstSpan and secondspans.next() are true,
      * but ensureSameDoc() = false
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         ki = new KrillIndex();
@@ -277,8 +278,9 @@
         assertEquals(9, kr.getMatch(2).endPos);
 
         // The secondspans is skipped to doc# of the current firstspans
-        SpanQuery sq = new SpanSegmentQuery(createQuery("s:d", "s:e", 3, 4,
-                true), createElementQuery("y", "x", 1, 2, true));
+        SpanQuery sq = new SpanSegmentQuery(
+                createQuery("s:d", "s:e", 3, 4, true),
+                createElementQuery("y", "x", 1, 2, true));
         kr = ki.search(sq, (short) 10);
 
         assertEquals(kr.getTotalResults(), 1);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
index 23b6ac8..e2aa270 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
@@ -25,8 +25,9 @@
     private SpanQuery createQuery (String e, String x, String y, int min,
             int max, boolean isOrdered, boolean exclusion) {
         SpanElementQuery eq = new SpanElementQuery("base", e);
-        SpanDistanceQuery sq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("base", x)), new SpanTermQuery(new Term("base", y)),
+        SpanDistanceQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("base", x)),
+                new SpanTermQuery(new Term("base", y)),
                 new DistanceConstraint(eq, min, max, isOrdered, exclusion),
                 true);
         return sq;
@@ -87,7 +88,7 @@
     /**
      * Distance Zero, unordered
      * There is a secondspan on the right side
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki = new KrillIndex();
@@ -105,7 +106,7 @@
     /**
      * There is another firstspan within max distance
      * Unordered
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki = new KrillIndex();
@@ -130,7 +131,7 @@
 
     /**
      * Distance 0-1, ordered, unordered
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki = new KrillIndex();
@@ -158,7 +159,7 @@
     /**
      * Multiple documents, ordered
      * No more secondspans, but there is still a firstspan
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         ki = new KrillIndex();
@@ -183,7 +184,7 @@
 
     /**
      * Skip to
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         ki = new KrillIndex();
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index 7716322..8ecc031 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -49,9 +49,7 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "tokens",
-                "ecebdc",
+        fd.addTV("tokens", "ecebdc",
                 "[(0-1)s:e|_1$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>6<i>6<b>0|<>:s$<b>64<i>0<i>2<i>1<b>0]"
                         + "[(1-2)s:c|s:b|_2$<i>1<i>2|<>:s$<b>64<i>1<i>2<i>2<b>0]"
                         + "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
@@ -105,7 +103,7 @@
      * Ensure terms and elements are in the same doc
      * Ensure terms are in elements
      * Check filter candidate list
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         //System.out.println("testCase1");
@@ -129,7 +127,7 @@
 
     /**
      * Ensure terms and elements are in the same doc
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         //System.out.println("testCase2");
@@ -206,8 +204,9 @@
         ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
         ki.commit();
 
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/cosmas1.json")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/cosmas1.json").getFile(),
+                "UTF-8");
         SpanQueryWrapper sqwi = jsonQuery(jsonPath);
         kr = ki.search(sqwi.toQuery(), (short) 10);
 
@@ -235,8 +234,9 @@
         assertEquals(kr.getTotalResults(), 1);
         assertEquals("[[ecebdc]]", kr.getMatch(0).getSnippetBrackets());
 
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/distances/in-same-t.jsonld")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(getClass()
+                .getResource("/queries/distances/in-same-t.jsonld").getFile(),
+                "UTF-8");
         sqwi = jsonQuery(jsonPath);
 
         assertEquals(
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
index 3c83f4f..5cd2d80 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
@@ -80,12 +80,13 @@
 
         // <a><a><a>h</a>hhij</a>hij</a>hij</a>
         FieldDocument fd = new FieldDocument();
-        fd.addTV("base", "h  h        i  j   h  i  j  h  i  j  ", "[(0-3)s:h|"
-                + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
-                + "<>:a$<b>64<i>0<i>27<i>6<b>0|" + "<>:a$<b>64<i>0<i>36<i>9]"
-                + "[(3-6)s:h]" + "[(12-15)s:i<b>0]" + "[(15-18)s:j]"
-                + "[(18-21)s:h]" + "[(21-24)s:i]" + "[(24-27)s:j]"
-                + "[(27-30)s:h]" + "[(30-33)s:i]" + "[(33-36)s:j]");
+        fd.addTV("base", "h  h        i  j   h  i  j  h  i  j  ",
+                "[(0-3)s:h|" + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+                        + "<>:a$<b>64<i>0<i>27<i>6<b>0|"
+                        + "<>:a$<b>64<i>0<i>36<i>9]" + "[(3-6)s:h]"
+                        + "[(12-15)s:i<b>0]" + "[(15-18)s:j]" + "[(18-21)s:h]"
+                        + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
+                        + "[(30-33)s:i]" + "[(33-36)s:j]");
         ki.addDoc(fd);
 
         // Save documents
@@ -131,15 +132,13 @@
 
         // xyz
         fd = new FieldDocument();
-        fd.addTV("base", "x  y  z  ", "[(0-3)s:x]" + "[(3-6)s:y]"
-                + "[(6-9)s:z]");
+        fd.addTV("base", "x  y  z  ",
+                "[(0-3)s:x]" + "[(3-6)s:y]" + "[(6-9)s:z]");
         ki.addDoc(fd);
 
         // <a>x<a><b>y<a>zcde</a>cde</b></a>cde</a>
         fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "x  y  z  k  l  m  k  l  m  k  l  m  ",
+        fd.addTV("base", "x  y  z  k  l  m  k  l  m  k  l  m  ",
                 "[(0-3)s:x|<>:a$<b>64<i>0<i>3<i>12<b>0]"
                         + "[(3-6)s:y|<>:a$<b>64<i>3<i>6<i>9<b>0|<>:b$<b>64<i>3<i>6<i>9<b>0]"
                         + "[(6-9)s:z|<>:a$<b>64<i>6<i>9<i>6<b>0]"
@@ -150,19 +149,19 @@
 
         // <a><a><a>h</a>hhij</a>hij</a>hij</a>
         fd = new FieldDocument();
-        fd.addTV("base", "h  h        i  j  h  i  j  h  i  j  ", "[(0-3)s:h|"
-                + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
-                + "<>:a$<b>64<i>0<i>27<i>6<b>0|"
-                + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
-                + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
-                + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
-                + "[(30-33)s:i]" + "[(33-36)s:j]");
+        fd.addTV("base", "h  h        i  j  h  i  j  h  i  j  ",
+                "[(0-3)s:h|" + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+                        + "<>:a$<b>64<i>0<i>27<i>6<b>0|"
+                        + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
+                        + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
+                        + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
+                        + "[(30-33)s:i]" + "[(33-36)s:j]");
         ki.addDoc(fd);
 
         // xyz
         fd = new FieldDocument();
-        fd.addTV("base", "a  b  c  ", "[(0-3)s:a]" + "[(3-6)s:b]"
-                + "[(6-9)s:c]");
+        fd.addTV("base", "a  b  c  ",
+                "[(0-3)s:a]" + "[(3-6)s:b]" + "[(6-9)s:c]");
         ki.addDoc(fd);
 
 
@@ -214,11 +213,8 @@
         KrillIndex ki = new KrillIndex();
 
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "111111ccc222222fff333333iiijjj",
-                "[(0-3)s:a|_0$<i>0<i>3]"
-                        + "[(3-6)s:b|_1$<i>3<i>6]"
+        fd.addTV("base", "111111ccc222222fff333333iiijjj",
+                "[(0-3)s:a|_0$<i>0<i>3]" + "[(3-6)s:b|_1$<i>3<i>6]"
                         + "[(6-9)s:c|_2$<i>6<i>9]"
                         + "[(9-12)s:d|_3$<i>9<i>12|<>:a$<b>64<i>9<i>15<i>4<b>0]"
                         + "[(12-15)s:e|_4$<i>12<i>15]"
@@ -239,10 +235,10 @@
         Result kr = ki.search(sq, 0, (short) 15, false, (short) 3, false,
                 (short) 3);
 
-        assertEquals("... ccc[[222222]]fff ...", kr.getMatch(0)
-                .getSnippetBrackets());
-        assertEquals("... fff[[333333]]iii ...", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("... ccc[[222222]]fff ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... fff[[333333]]iii ...",
+                kr.getMatch(1).getSnippetBrackets());
     };
 
 
@@ -251,12 +247,9 @@
         KrillIndex ki = new KrillIndex();
 
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "111111ccc222222fff333333iiijjj",
+        fd.addTV("base", "111111ccc222222fff333333iiijjj",
                 "[(0-3)s:a|_0$<i>0<i>3|<>:a$<b>64<i>0<i>6<i>1<b>0]"
-                        + "[(3-6)s:b|_1$<i>3<i>6]"
-                        + "[(6-9)s:c|_2$<i>6<i>9]"
+                        + "[(3-6)s:b|_1$<i>3<i>6]" + "[(6-9)s:c|_2$<i>6<i>9]"
                         + "[(9-12)s:d|_3$<i>9<i>12|<>:a$<b>64<i>9<i>15<i>4<b>0]"
                         + "[(12-15)s:e|_4$<i>12<i>15]"
                         + "[(15-18)s:f|_5$<i>15<i>18]"
@@ -277,10 +270,10 @@
                 (short) 3);
 
         assertEquals("[[111111]]ccc ...", kr.getMatch(0).getSnippetBrackets());
-        assertEquals("... ccc[[222222]]fff ...", kr.getMatch(1)
-                .getSnippetBrackets());
-        assertEquals("... fff[[333333]]iii ...", kr.getMatch(2)
-                .getSnippetBrackets());
+        assertEquals("... ccc[[222222]]fff ...",
+                kr.getMatch(1).getSnippetBrackets());
+        assertEquals("... fff[[333333]]iii ...",
+                kr.getMatch(2).getSnippetBrackets());
     };
 
 
@@ -307,10 +300,11 @@
         ki.addDoc(fd);
 
         fd = new FieldDocument();
-        fd.addTV("base", "x  y  z  h  ", "[(0-3)s:x|_0$<i>0<i>3]" + // 1
-                "[(3-6)s:y|_1$<i>3<i>6]" + // 2
-                "[(6-9)s:z|_2$<i>6<i>9]" + // 3
-                "[(9-12)s:h|_3$<i>9<i>12]"); // 4
+        fd.addTV("base", "x  y  z  h  ",
+                "[(0-3)s:x|_0$<i>0<i>3]" + // 1
+                        "[(3-6)s:y|_1$<i>3<i>6]" + // 2
+                        "[(6-9)s:z|_2$<i>6<i>9]" + // 3
+                        "[(9-12)s:h|_3$<i>9<i>12]"); // 4
         ki.addDoc(fd);
 
         // Here is a larger offset than expected
@@ -340,10 +334,11 @@
         ki.addDoc(fd);
 
         fd = new FieldDocument();
-        fd.addTV("base", "x  y  z  h  ", "[(0-3)s:x|_0$<i>0<i>3]" + // 1
-                "[(3-6)s:y|_1$<i>3<i>6]" + // 2
-                "[(6-9)s:z|_2$<i>6<i>9]" + // 3
-                "[(9-12)s:h|_3$<i>9<i>12]"); // 4
+        fd.addTV("base", "x  y  z  h  ",
+                "[(0-3)s:x|_0$<i>0<i>3]" + // 1
+                        "[(3-6)s:y|_1$<i>3<i>6]" + // 2
+                        "[(6-9)s:z|_2$<i>6<i>9]" + // 3
+                        "[(9-12)s:h|_3$<i>9<i>12]"); // 4
         ki.addDoc(fd);
 
         // Save documents
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index a570e93..512535d 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -84,27 +84,20 @@
     @Test
     public void indexExample2 () throws Exception {
 
-        String json = new String(
-                "{"
-                        + "  \"fields\" : ["
-                        + "    { "
-                        + "      \"primaryData\" : \"abc\""
-                        + "    },"
-                        + "    {"
-                        + "      \"name\" : \"tokens\","
-                        + "      \"data\" : ["
-                        + "         [ \"s:a\", \"i:a\", \"_0$<i>0<i>1\", \"-:t$<i>3\"],"
-                        + "         [ \"s:b\", \"i:b\", \"_1$<i>1<i>2\" ],"
-                        + "         [ \"s:c\", \"i:c\", \"_2$<i>2<i>3\" ]"
-                        + "      ]" + "    }" + "  ],"
-                        + "  \"corpusID\"  : \"WPD\","
-                        + "  \"ID\"        : \"WPD-AAA-00001\","
-                        + "  \"textClass\" : \"music entertainment\","
-                        + "  \"author\"    : \"Peter Frankenfeld\","
-                        + "  \"pubDate\"   : 20130617,"
-                        + "  \"title\"     : \"Wikipedia\","
-                        + "  \"subTitle\"  : \"Die freie Enzyklopädie\","
-                        + "  \"pubPlace\"  : \"Bochum\"" + "}");
+        String json = new String("{" + "  \"fields\" : [" + "    { "
+                + "      \"primaryData\" : \"abc\"" + "    }," + "    {"
+                + "      \"name\" : \"tokens\"," + "      \"data\" : ["
+                + "         [ \"s:a\", \"i:a\", \"_0$<i>0<i>1\", \"-:t$<i>3\"],"
+                + "         [ \"s:b\", \"i:b\", \"_1$<i>1<i>2\" ],"
+                + "         [ \"s:c\", \"i:c\", \"_2$<i>2<i>3\" ]" + "      ]"
+                + "    }" + "  ]," + "  \"corpusID\"  : \"WPD\","
+                + "  \"ID\"        : \"WPD-AAA-00001\","
+                + "  \"textClass\" : \"music entertainment\","
+                + "  \"author\"    : \"Peter Frankenfeld\","
+                + "  \"pubDate\"   : 20130617,"
+                + "  \"title\"     : \"Wikipedia\","
+                + "  \"subTitle\"  : \"Die freie Enzyklopädie\","
+                + "  \"pubPlace\"  : \"Bochum\"" + "}");
 
         KrillIndex ki = new KrillIndex();
         FieldDocument fd = ki.addDoc(json);
@@ -122,8 +115,8 @@
         assertEquals(fd.getPubDate().toDisplay(), "2013-06-17");
 
         QueryBuilder kq = new QueryBuilder("tokens");
-        Result kr = ki.search((SpanQuery) kq.seq(kq._(3, kq.seg("s:b")))
-                .toQuery());
+        Result kr = ki
+                .search((SpanQuery) kq.seq(kq._(3, kq.seg("s:b"))).toQuery());
 
         Match km = kr.getMatch(0);
 
@@ -164,11 +157,8 @@
         // Start creating query
         // within(<s>, {1: {2: [mate/p=ADJA & mate/m=number:sg]}[opennlp/p=NN & tt/p=NN]})
 
-        ks = new Krill(kq.within(
-                kq.tag("base/s:s"),
-                kq._(1,
-                        kq.seq(kq.seg("mate/p:ADJA")).append(
-                                kq.seg("opennlp/p:NN")))));
+        ks = new Krill(kq.within(kq.tag("base/s:s"), kq._(1,
+                kq.seq(kq.seg("mate/p:ADJA")).append(kq.seg("opennlp/p:NN")))));
 
         KrillMeta meta = ks.getMeta();
         meta.setCount(1);
@@ -199,9 +189,10 @@
         };
         ki.commit();
 
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/bsp18.jsonld")
-                .getFile(),"UTF-8");
-        
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/bsp18.jsonld").getFile(),
+                "UTF-8");
+
         // {1:der} \w0:5 nicht
         SpanQueryWrapper sqwi = jsonQuery(jsonPath);
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFocusIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestFocusIndex.java
index b835df1..9228c78 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFocusIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFocusIndex.java
@@ -28,14 +28,15 @@
 
     /**
      * Check Skipto focus spans
-     * */
+     */
     @Test
     public void testCase12 () throws IOException {
         ki.addDoc(TestRelationIndex.createFieldDoc0());
         ki.addDoc(TestRelationIndex.createFieldDoc1());
         ki.commit();
-        SpanRelationQuery sq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:xip/syntax-dep_rel")), true);
+        SpanRelationQuery sq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:xip/syntax-dep_rel")),
+                true);
         sq.setSourceClass((byte) 1);
 
         SpanFocusQuery sfq = new SpanFocusQuery(sq, (byte) 1);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
index 9b08699..7aff713 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
@@ -232,24 +232,27 @@
 
         // textClass
         // All texts of text class "news"
-        assertEquals(2, searcher.search(new TermQuery(new Term("textClass",
-                "news")), 10).totalHits);
+        assertEquals(2,
+                searcher.search(new TermQuery(new Term("textClass", "news")),
+                        10).totalHits);
 
         // textClass
         // All texts of text class "sports"
-        assertEquals(2, searcher.search(new TermQuery(new Term("textClass",
-                "sports")), 10).totalHits);
+        assertEquals(2,
+                searcher.search(new TermQuery(new Term("textClass", "sports")),
+                        10).totalHits);
 
         // TextIndex
         // All docs containing "l:nehmen"
-        assertEquals(1, searcher.search(new TermQuery(new Term("text",
-                "l:nehmen")), 10).totalHits);
+        assertEquals(1,
+                searcher.search(new TermQuery(new Term("text", "l:nehmen")),
+                        10).totalHits);
 
         // TextIndex
         // All docs containing "s:den"
-        assertEquals(
-                2,
-                searcher.search(new TermQuery(new Term("text", "s:den")), 10).totalHits);
+        assertEquals(2,
+                searcher.search(new TermQuery(new Term("text", "s:den")),
+                        10).totalHits);
 
         /*
         assertEquals(3,
@@ -311,8 +314,8 @@
         assertEquals(2, searcher.search(srquery, 10).totalHits);
 
         ssrquery = new SpanRegexQueryWrapper("text", "s:e.", true);
-        assertEquals("SpanMultiTermQueryWrapper(text:/i:e./)", ssrquery
-                .toQuery().toString());
+        assertEquals("SpanMultiTermQueryWrapper(text:/i:e./)",
+                ssrquery.toQuery().toString());
         assertEquals(2, searcher.search(ssrquery.toQuery(), 10).totalHits);
 
         // All docs containing "ng"/x (Angst) (2x)
@@ -325,60 +328,72 @@
 
         // vor Angst
         // [orth=vor][orth=Angst]
-        SpanNearQuery snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "s:vor")),
-                new SpanTermQuery(new Term("text", "s:Angst")) }, 1, true);
+        SpanNearQuery snquery = new SpanNearQuery(
+                new SpanQuery[] { new SpanTermQuery(new Term("text", "s:vor")),
+                        new SpanTermQuery(new Term("text", "s:Angst")) },
+                1, true);
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
         // Spannearquery [p:VVFIN][]{,5}[m:nom:sg:fem]
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:VVFIN")),
-                new SpanSegmentQueryWrapper("text", "m:c:nom", "m:n:sg",
-                        "m:g:fem").toQuery() }, 5,     // slop
+        snquery = new SpanNearQuery(
+                new SpanQuery[] {
+                        new SpanTermQuery(new Term("text", "p:VVFIN")),
+                        new SpanSegmentQueryWrapper("text", "m:c:nom", "m:n:sg",
+                                "m:g:fem").toQuery() },
+                5,     // slop
                 true   // inOrder
-                     // Possible: CollectPayloads
+            // Possible: CollectPayloads
         );
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
 
         // Spannearquery [p:VVFIN][m:acc:sg:masc]
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:VVFIN")),
-                new SpanNearQuery(new SpanQuery[] {
-                        new SpanTermQuery(new Term("text", "m:c:acc")),
-                        new SpanNearQuery(
-                                new SpanQuery[] {
-                                        new SpanTermQuery(new Term("text",
-                                                "m:n:sg")),
-                                        new SpanTermQuery(new Term("text",
-                                                "m:g:masc")) }, -1, false) },
+        snquery = new SpanNearQuery(new SpanQuery[] { new SpanTermQuery(
+                new Term("text", "p:VVFIN")),
+                new SpanNearQuery(
+                        new SpanQuery[] {
+                                new SpanTermQuery(new Term("text", "m:c:acc")),
+                                new SpanNearQuery(
+                                        new SpanQuery[] {
+                                                new SpanTermQuery(new Term(
+                                                        "text", "m:n:sg")),
+                                                new SpanTermQuery(new Term(
+                                                        "text", "m:g:masc")) },
+                                        -1, false) },
                         -1,     // slop
                         false   // inOrder
                 // Possible: CollectPayloads
                 )
-        // new SpanTermQuery(new Term("text", "m:-acc:--sg:masc"))
-                }, 0,     // slop
+                // new SpanTermQuery(new Term("text", "m:-acc:--sg:masc"))
+        }, 0,     // slop
                 true   // inOrder
-                     // Possible: CollectPayloads
+            // Possible: CollectPayloads
         );
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
 
         // Spannearquery [p:VVFIN|m:3:sg:past:ind]
         // Exact match!
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:VVFIN")),
-                new SpanNearQuery(new SpanQuery[] {
-                        new SpanTermQuery(new Term("text", "m:p:3")),
+        snquery = new SpanNearQuery(
+                new SpanQuery[] {
+                        new SpanTermQuery(new Term("text", "p:VVFIN")),
                         new SpanNearQuery(new SpanQuery[] {
-                                new SpanTermQuery(new Term("text", "m:n:sg")),
+                                new SpanTermQuery(new Term("text", "m:p:3")),
                                 new SpanNearQuery(new SpanQuery[] {
-                                        new SpanTermQuery(new Term("text",
-                                                "m:t:past")),
-                                        new SpanTermQuery(new Term("text",
-                                                "m:m:ind")), }, -1, false) },
-                                -1, false) }, -1, false) },
-        // new SpanTermQuery(new Term("text", "m:---3:--sg:past:-ind"))
+                                        new SpanTermQuery(
+                                                new Term("text", "m:n:sg")),
+                                        new SpanNearQuery(
+                                                new SpanQuery[] {
+                                                        new SpanTermQuery(
+                                                                new Term("text",
+                                                                        "m:t:past")),
+                                                        new SpanTermQuery(
+                                                                new Term("text",
+                                                                        "m:m:ind")), },
+                                                -1, false) },
+                                        -1, false) },
+                                -1, false) },
+                // new SpanTermQuery(new Term("text", "m:---3:--sg:past:-ind"))
                 -1,     // slop
                 false   // inOrder
         // Possible: CollectPayloads
@@ -389,12 +404,14 @@
         // Spannearquery [p:VVFIN & m:3:sg:past:ind]
         // Exact match!
         // Maybe it IS equal
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:VVFIN")),
-                new SpanTermQuery(new Term("text", "m:p:3")),
-                new SpanTermQuery(new Term("text", "m:n:sg")),
-                new SpanTermQuery(new Term("text", "m:t:past")),
-                new SpanTermQuery(new Term("text", "m:m:ind")), }, -1,     // slop
+        snquery = new SpanNearQuery(
+                new SpanQuery[] {
+                        new SpanTermQuery(new Term("text", "p:VVFIN")),
+                        new SpanTermQuery(new Term("text", "m:p:3")),
+                        new SpanTermQuery(new Term("text", "m:n:sg")),
+                        new SpanTermQuery(new Term("text", "m:t:past")),
+                        new SpanTermQuery(new Term("text", "m:m:ind")), },
+                -1,     // slop
                 false   // inOrder
         // Possible: CollectPayloads
         );
@@ -421,12 +438,14 @@
         */
 
         // Spannearquery [p:VVFIN][]{,5}[m:nom:sg:fem]
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:VVFIN")),
-                new SpanSegmentQueryWrapper("text", "m:c:nom", "m:n:sg",
-                        "m:g:fem").toQuery() }, 5,     // slop
+        snquery = new SpanNearQuery(
+                new SpanQuery[] {
+                        new SpanTermQuery(new Term("text", "p:VVFIN")),
+                        new SpanSegmentQueryWrapper("text", "m:c:nom", "m:n:sg",
+                                "m:g:fem").toQuery() },
+                5,     // slop
                 true   // inOrder
-                     // Possible: CollectPayloads
+            // Possible: CollectPayloads
         );
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
@@ -445,41 +464,40 @@
         assertEquals(2, searcher.search(snqquery, 10).totalHits);
 
         // [p = NN & (m:c: = dat | m:c = acc)]
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanTermQuery(new Term("text", "p:NN")),
-                new SpanOrQuery(new SpanTermQuery(new Term("text", "m:c:nom")),
-                        new SpanTermQuery(new Term("text", "m:c:acc"))) }, -1,
-                false);
+        snquery = new SpanNearQuery(
+                new SpanQuery[] { new SpanTermQuery(new Term("text", "p:NN")),
+                        new SpanOrQuery(
+                                new SpanTermQuery(new Term("text", "m:c:nom")),
+                                new SpanTermQuery(
+                                        new Term("text", "m:c:acc"))) },
+                -1, false);
 
         assertEquals(2, searcher.search(snqquery, 10).totalHits);
 
         // [p = NN & !(m:c: = nom | m:c = acc)]
-        snqquery = new SpanNotQuery(
-                new SpanTermQuery(new Term("text", "p:NN")), new SpanOrQuery(
-                        new SpanTermQuery(new Term("text", "m:c:nom")),
+        snqquery = new SpanNotQuery(new SpanTermQuery(new Term("text", "p:NN")),
+                new SpanOrQuery(new SpanTermQuery(new Term("text", "m:c:nom")),
                         new SpanTermQuery(new Term("text", "m:c:acc"))));
         assertEquals(1, searcher.search(snqquery, 10).totalHits);
 
         // [p = NN & !(m:c = nom)]
-        snqquery = new SpanNotQuery(
-                new SpanTermQuery(new Term("text", "p:NN")), new SpanTermQuery(
-                        new Term("text", "m:c:nom")));
+        snqquery = new SpanNotQuery(new SpanTermQuery(new Term("text", "p:NN")),
+                new SpanTermQuery(new Term("text", "m:c:nom")));
         assertEquals(3, searcher.search(snqquery, 10).totalHits);
 
         // [p=NN & !(m:c = acc)]
-        snqquery = new SpanNotQuery(
-                new SpanTermQuery(new Term("text", "p:NN")), new SpanTermQuery(
-                        new Term("text", "m:c:acc")));
+        snqquery = new SpanNotQuery(new SpanTermQuery(new Term("text", "p:NN")),
+                new SpanTermQuery(new Term("text", "m:c:acc")));
         assertEquals(2, searcher.search(snqquery, 10).totalHits);
 
         // [p=PPER][][p=ART]
         snquery = new SpanNearQuery(
-                new SpanQuery[] {
-                        new SpanTermQuery(new Term("text", "p:PPER")),
+                new SpanQuery[] { new SpanTermQuery(new Term("text", "p:PPER")),
                         new SpanNearQuery(new SpanQuery[] {
                                 new SpanTermQuery(new Term("text", "T")),
                                 new SpanTermQuery(new Term("text", "p:ART")) },
-                                0, true), }, 0, true);
+                                0, true), },
+                0, true);
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
 
@@ -498,11 +516,14 @@
 
 
         // [][][p:VAFIN]
-        snquery = new SpanNearQuery(new SpanQuery[] {
-                new SpanNearQuery(new SpanQuery[] {
-                        new SpanTermQuery(new Term("text", "T")),
-                        new SpanTermQuery(new Term("text", "T")) }, 0, true),
-                new SpanTermQuery(new Term("text", "p:VAFIN")) }, 0, true);
+        snquery = new SpanNearQuery(
+                new SpanQuery[] {
+                        new SpanNearQuery(new SpanQuery[] {
+                                new SpanTermQuery(new Term("text", "T")),
+                                new SpanTermQuery(new Term("text", "T")) }, 0,
+                                true),
+                        new SpanTermQuery(new Term("text", "p:VAFIN")) },
+                0, true);
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
         /*
@@ -540,8 +561,8 @@
                                 new SpanTermQuery(new Term("text", "T")),
                                 new SpanTermQuery(new Term("text", "T")) }, 0,
                                 true, false),
-                        new SpanTermQuery(new Term("text", "p:VAFIN")) }, 0,
-                true, false);
+                        new SpanTermQuery(new Term("text", "p:VAFIN")) },
+                0, true, false);
         assertEquals(1, searcher.search(snquery, 10).totalHits);
 
         payloadString = new StringBuilder();
@@ -567,19 +588,19 @@
         // ([e:s:<][]*[T] | [T & e:s:<]) [T] ([p:VAFIN & e:s:>] | [T][]*[e:s:>]
 
         /*
-
+        
         SpanSegmentWithinQuery ssequery = new SpanSegmentWithinQuery(
             "text","s", new SpanSegmentSequenceQuery("text", "T", "T", "p:VAFIN")
             );
         assertEquals(0, searcher.search(ssequery.toQuery(), 10).totalHits);
-
+        
         payloadString = new StringBuilder();
         termContexts = new HashMap<>();
         for (LeafReaderContext atomic : reader.leaves()) {
             Bits bitset = atomic.reader().getLiveDocs();
             // Spans spans = NearSpansOrdered();
             Spans spans = ssequery.toQuery().getSpans(atomic, bitset, termContexts);
-
+        
             while (spans.next()) {
         	int docid = atomic.docBase + spans.doc();
         	for (byte[] payload : spans.getPayload()) {
@@ -590,21 +611,21 @@
             };
         };
         assertEquals(0, payloadString.length(), 1);
-
+        
         ssequery = new SpanSegmentWithinQuery(
             "text","s", new SpanSegmentSequenceQuery("text", "T", "p:VAFIN")
             );
-
+        
         assertEquals("for " + ssequery.toQuery(),
         	     1, searcher.search(ssequery.toQuery(), 10).totalHits);
-
+        
         payloadString = new StringBuilder();
         termContexts = new HashMap<>();
         for (LeafReaderContext atomic : reader.leaves()) {
             Bits bitset = atomic.reader().getLiveDocs();
             // Spans spans = NearSpansOrdered();
             Spans spans = ssequery.toQuery().getSpans(atomic, bitset, termContexts);
-
+        
             while (spans.next()) {
         	int docid = atomic.docBase + spans.doc();
         	for (byte[] payload : spans.getPayload()) {
@@ -616,7 +637,7 @@
             };
         };
         assertEquals(20, payloadString.length());
-
+        
         */
 
         // --------------------______>
@@ -630,7 +651,7 @@
         for (int i = 0; i < topDocs.scoreDocs.length; i++) {
           while (spans.next()) {
             Collection<byte[]> payloads = spans.getPayload();
-
+        
             for (final byte [] payload : payloads) {
               payloadSet.add(new String(payload, "UTF-8"));
             }
@@ -644,7 +665,7 @@
         IndexReader reader = writer.getReader();
         writer.close();
         IndexSearcher searcher = newSearcher(reader);
-
+        
         PayloadSpanUtil psu = new PayloadSpanUtil(searcher.getTopReaderContext());
         
         Collection<byte[]> payloads = psu.getPayloadsForQuery(new TermQuery(new Term(PayloadHelper.FIELD, "rr")));
@@ -671,7 +692,7 @@
         Spans luceneSpans;
         Bits bitset = atomic.reader().getLiveDocs();
         for (byte[] payload : luceneSpans.getPayload())
-
+        
         /* Iterate over all matching documents */
         /*
             while (luceneSpans.next() && total < config.getMaxhits()) {
@@ -681,7 +702,7 @@
         	String docname = search.retrieveDocname(docid,
         					querycontainer.getFoundry());
         					total++;
-
+        
         	for (byte[] payload : luceneSpans.getPayload())
         */
         /* retrieve payload for current matching span */
@@ -724,7 +745,7 @@
 
         /*
         SpanNearQuery poquery = new SpanNearQuery(
-
+        
         );
         */
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
index c20434b..024ea72 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
@@ -48,9 +48,8 @@
         fd.addInt("zahl3", "059");
         fd.addInt("UID", 1);
         fd.addText("teaser", "Das ist der Name der Rose");
-        fd.addTV("base", "ich bau",
-                "[(0-3)s:ich|l:ich|p:PPER|-:sentences$<i>2]"
-                        + "[(4-7)s:bau|l:bauen|p:VVFIN]");
+        fd.addTV("base", "ich bau", "[(0-3)s:ich|l:ich|p:PPER|-:sentences$<i>2]"
+                + "[(4-7)s:bau|l:bauen|p:VVFIN]");
         ki.addDoc(fd);
 
         fd = new FieldDocument();
@@ -136,10 +135,11 @@
 
         // These values are canonically equivalent
         // But indexed as byte sequences
-        fd.addTV("base", new String("ju" + "\u006E" + "\u0303" + "o") + " "
-                + new String("ju" + "\u00F1" + "o"), "[(0-5)s:ju" + "\u006E"
-                + "\u0303" + "o|_0$<i>0<i>5|-:t$<i>2]" + "[(6-10)s:ju"
-                + "\u00F1" + "o|_1$<i>6<i>10]");
+        fd.addTV("base",
+                new String("ju" + "\u006E" + "\u0303" + "o") + " "
+                        + new String("ju" + "\u00F1" + "o"),
+                "[(0-5)s:ju" + "\u006E" + "\u0303" + "o|_0$<i>0<i>5|-:t$<i>2]"
+                        + "[(6-10)s:ju" + "\u00F1" + "o|_1$<i>6<i>10]");
         ki.addDoc(fd);
         ki.commit();
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java
index 0c85b64..7fe7c37 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java
@@ -41,12 +41,12 @@
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
         fd.addString("UID", "2");
-        fd.addTV("base", "bcbabd", "[(0-1)s:b|i:b|_1$<i>0<i>1]"
-                + "[(1-2)s:c|i:c|s:b|_2$<i>1<i>2]"
-                + "[(2-3)s:b|i:b|_3$<i>2<i>3|<>:e#2-4$<i>4]"
-                + "[(3-4)s:a|i:a|_4$<i>3<i>4|<>:e#3-5$<i>5|<>:e2#3-5$<i>5]"
-                + "[(4-5)s:b|i:b|s:c|_5$<i>4<i>5]"
-                + "[(5-6)s:d|i:d|_6$<i>5<i>6|<>:e2#5-6$<i>6]");
+        fd.addTV("base", "bcbabd",
+                "[(0-1)s:b|i:b|_1$<i>0<i>1]" + "[(1-2)s:c|i:c|s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:b|i:b|_3$<i>2<i>3|<>:e#2-4$<i>4]"
+                        + "[(3-4)s:a|i:a|_4$<i>3<i>4|<>:e#3-5$<i>5|<>:e2#3-5$<i>5]"
+                        + "[(4-5)s:b|i:b|s:c|_5$<i>4<i>5]"
+                        + "[(5-6)s:d|i:d|_6$<i>5<i>6|<>:e2#5-6$<i>6]");
         ki.addDoc(fd);
 
         ki.commit();
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index 072a633..e53ad87 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -67,7 +67,8 @@
         id = new MatchIdentifier("match-c1!d1-p4-20(5)7-8(-2)9-10");
         assertEquals(id.toString(), "match-c1!d1-p4-20(5)7-8");
 
-        id = new MatchIdentifier("match-c1!d1-p4-20(5)7-8(-2)9-10(2)3-4(3)-5-6");
+        id = new MatchIdentifier(
+                "match-c1!d1-p4-20(5)7-8(-2)9-10(2)3-4(3)-5-6");
         assertEquals(id.toString(), "match-c1!d1-p4-20(5)7-8(2)3-4");
 
         id = new MatchIdentifier(
@@ -117,8 +118,8 @@
         ki.commit();
 
         QueryBuilder kq = new QueryBuilder("tokens");
-        Krill ks = new Krill(kq._(2,
-                kq.seq(kq.seg("s:b")).append(kq._(kq.seg("s:a")))));
+        Krill ks = new Krill(
+                kq._(2, kq.seq(kq.seg("s:b")).append(kq._(kq.seg("s:a")))));
         Result kr = ki.search(ks);
 
         assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -149,11 +150,12 @@
 
         assertEquals("ID (0)", "match-c1!d1-p7-9(0)8-8(2)7-8", km.getID());
 
-        km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f",
-                "m", false, false);
+        km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f", "m",
+                false, false);
 
         assertEquals("SnippetBrackets (1)",
-                "... [[{f/m:acht:b}{f/m:neun:a}]] ...", km.getSnippetBrackets());
+                "... [[{f/m:acht:b}{f/m:neun:a}]] ...",
+                km.getSnippetBrackets());
 
 
         km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f",
@@ -162,15 +164,15 @@
                 "... [[{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}]] ...",
                 km.getSnippetBrackets());
 
-        km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f",
-                "m", false, true);
+        km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f", "m",
+                false, true);
 
         assertEquals("SnippetBrackets (2)",
                 "... [[{2:{f/m:acht:b}{{f/m:neun:a}}}]] ...",
                 km.getSnippetBrackets());
 
-        km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", "f",
-                "m", false, true);
+        km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", "f", "m",
+                false, true);
 
         assertEquals("SnippetBrackets (3)",
                 "... [[{2:{f/m:acht:b}{4:{f/m:neun:a}}}]] ...",
@@ -179,22 +181,22 @@
         km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", "f",
                 null, false, true);
 
-        assertEquals(
-                "SnippetBrackets (4)",
+        assertEquals("SnippetBrackets (4)",
                 "... [[{2:{f/m:acht:{f/y:eight:b}}{4:{f/m:neun:{f/y:nine:a}}}}]] ...",
                 km.getSnippetBrackets());
 
-        assertEquals("SnippetHTML (4)", "<span class=\"context-left\">"
-                + "<span class=\"more\">" + "</span>" + "</span>"
-                + "<span class=\"match\">" + "<mark>"
-                + "<mark class=\"class-2 level-0\">"
-                + "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
-                + "b" + "</span>" + "</span>"
-                + "<mark class=\"class-4 level-1\">"
-                + "<span title=\"f/m:neun\">" + "<span title=\"f/y:nine\">"
-                + "a" + "</span>" + "</span>" + "</mark>" + "</mark>"
-                + "</mark>" + "</span>" + "<span class=\"context-right\">"
-                + "<span class=\"more\">" + "</span>" + "</span>",
+        assertEquals("SnippetHTML (4)",
+                "<span class=\"context-left\">" + "<span class=\"more\">"
+                        + "</span>" + "</span>" + "<span class=\"match\">"
+                        + "<mark>" + "<mark class=\"class-2 level-0\">"
+                        + "<span title=\"f/m:acht\">"
+                        + "<span title=\"f/y:eight\">" + "b" + "</span>"
+                        + "</span>" + "<mark class=\"class-4 level-1\">"
+                        + "<span title=\"f/m:neun\">"
+                        + "<span title=\"f/y:nine\">" + "a" + "</span>"
+                        + "</span>" + "</mark>" + "</mark>" + "</mark>"
+                        + "</span>" + "<span class=\"context-right\">"
+                        + "<span class=\"more\">" + "</span>" + "</span>",
                 km.getSnippetHTML());
 
         JsonNode res = mapper.readTree(km.toJsonString());
@@ -203,8 +205,8 @@
         assertTrue(res.at("/endMore").asBoolean());
         assertEquals("c1", res.at("/corpusID").asText());
         assertEquals("d1", res.at("/docID").asText());
-        assertEquals("match-c1!d1-p7-9(4)8-8(2)7-8", res.at("/matchID")
-                .asText());
+        assertEquals("match-c1!d1-p7-9(4)8-8(2)7-8",
+                res.at("/matchID").asText());
         assertTrue(res.at("/pubDate").isMissingNode());
     };
 
@@ -267,8 +269,8 @@
         ki.addDoc(getClass().getResourceAsStream("/goe/AGX-00002.json"), false);
         ki.commit();
 
-        Match km = ki.getMatchInfo("match-GOE!GOE_AGX.00002-p210-211",
-                "tokens", true, (String) null, (String) null, true, true, true);
+        Match km = ki.getMatchInfo("match-GOE!GOE_AGX.00002-p210-211", "tokens",
+                true, (String) null, (String) null, true, true, true);
 
         JsonNode res = mapper.readTree(km.toJsonString());
         assertEquals("tokens", res.at("/field").asText());
@@ -294,8 +296,7 @@
                 null, null, true, false);
 
 
-        assertEquals(
-                "SnippetBrackets (1)",
+        assertEquals("SnippetBrackets (1)",
                 "... [[{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}]] ...",
                 km.getSnippetBrackets());
     };
@@ -311,8 +312,7 @@
                 null, null, true, false);
 
 
-        assertEquals(
-                "SnippetBrackets (1)",
+        assertEquals("SnippetBrackets (1)",
                 "... [[{x/tag:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]",
                 km.getSnippetBrackets());
     };
@@ -328,15 +328,14 @@
                 null, null, true, true);
 
 
-        assertEquals(
-                "SnippetBrackets (1)",
+        assertEquals("SnippetBrackets (1)",
                 "... [[{x/tag:{2:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{4:{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]",
                 km.getSnippetBrackets());
 
         assertEquals("SnippetHTML (1)", "<span class=\"context-left\">"
                 + "<span class=\"more\">" + "</span>" + "</span>"
-                + "<span class=\"match\">" + "<mark>"
-                + "<span title=\"x/tag\">" + "<mark class=\"class-2 level-0\">"
+                + "<span class=\"match\">" + "<mark>" + "<span title=\"x/tag\">"
+                + "<mark class=\"class-2 level-0\">"
                 + "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
                 + "<span title=\"it/is:8\">" + "<span title=\"x/o:achtens\">"
                 + "b" + "</span>" + "</span>" + "</span>" + "</span>"
@@ -362,8 +361,7 @@
         Match km = ki.getMatchInfo("match-c1!d1-p0-5(4)8-8(2)7-8", "tokens",
                 "x", null, true, false);
 
-        assertEquals(
-                "SnippetBrackets (1)",
+        assertEquals("SnippetBrackets (1)",
                 "[[{x/rel:a>3:{x/o:erstens:a}}{x/o:zweitens:b}{x/o:drittens:c}{#3:{x/o:viertens:a}}{x/o:fünftens:b}]] ...",
                 km.getSnippetBrackets());
 
@@ -402,8 +400,8 @@
 
 
     @Test
-    public void indexExample7SentenceExpansion () throws IOException,
-            QueryException {
+    public void indexExample7SentenceExpansion ()
+            throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(createSimpleFieldDoc());
         ki.addDoc(createSimpleFieldDoc2());
@@ -433,9 +431,8 @@
                 + "<span class=\"match\">" + "<span title=\"f/m:drei\">"
                 + "<span title=\"f/y:three\">" + "<span title=\"it/is:3\">"
                 + "<span title=\"x/o:drittens\">c</span>" + "</span>"
-                + "</span>" + "</span>" + "<mark>"
-                + "<span title=\"f/m:vier\">" + "<span title=\"f/y:four\">"
-                + "<span title=\"it/is:4\">"
+                + "</span>" + "</span>" + "<mark>" + "<span title=\"f/m:vier\">"
+                + "<span title=\"f/y:four\">" + "<span title=\"it/is:4\">"
                 + "<span title=\"x/o:viertens\">a</span>" + "</span>"
                 + "</span>" + "</span>" + "</mark>"
                 + "<span title=\"f/m:fuenf\">" + "<span title=\"f/y:five\">"
@@ -449,12 +446,12 @@
         /*
         km = ki.getMatchInfo("match-c1!d3-p3-4", "tokens", null, null, false,
                 false, true); // extendToSentence
-
+        
         assertEquals(
                 "[{f/m:drei:{f/y:three:{it/is:3:{x/o:drittens:cc}}}} {f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:aa}}}} {f/m:fuenf:{f/y:five:{it/is:5:{x/o:fünftens:bb}}}}]",
                 km.getSnippetBrackets());
-
-
+        
+        
         km = ki.getMatchInfo("match-c1!d4-p4-6", "tokens", null, null, false,
                 false, true); // extendToSentence
         assertEquals(
@@ -465,7 +462,8 @@
 
 
     @Test
-    public void indexExample7Dependencies () throws IOException, QueryException {
+    public void indexExample7Dependencies ()
+            throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(createSimpleFieldDoc2());
         ki.commit();
@@ -473,63 +471,46 @@
         Match km = ki.getMatchInfo("match-c1!d1-p0-4", "tokens", null, null,
                 true, true);
 
-        assertEquals(
-                "SnippetHTML (2)",
-                "<span class=\"context-left\">"
-                        + "</span>"
-                        + "<span class=\"match\">"
-                        + "<mark>"
-                        + "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
-                        + "<span title=\"f/m:eins\">"
-                        + "<span title=\"f/y:one\">"
-                        + "<span title=\"it/is:1\">"
-                        + "<span title=\"x/o:erstens\">a</span>"
-                        + "</span>"
-                        + "</span>"
-                        + "</span>"
-                        + "</span>"
-                        + "<span xlink:title=\"x/rel:b\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
-                        + "<span title=\"f/m:zwei\">"
-                        + "<span title=\"f/y:two\">"
-                        + "<span title=\"it/is:2\">"
-                        + "<span title=\"x/o:zweitens\">b</span>" + "</span>"
-                        + "</span>" + "</span>" + "</span>"
-                        + "<span title=\"f/m:drei\">"
-                        + "<span title=\"f/y:three\">"
-                        + "<span title=\"it/is:3\">"
-                        + "<span title=\"x/o:drittens\">c</span>" + "</span>"
-                        + "</span>" + "</span>"
-                        + "<span xml:id=\"word-c1!d1-p3\">"
-                        + "<span title=\"f/m:vier\">"
-                        + "<span title=\"f/y:four\">"
-                        + "<span title=\"it/is:4\">"
-                        + "<span title=\"x/o:viertens\">a</span>" + "</span>"
-                        + "</span>" + "</span>" + "</span>" + "</mark>"
-                        + "</span>" + "<span class=\"context-right\">"
-                        + "<span class=\"more\">" + "</span>" + "</span>",
-                km.getSnippetHTML());
+        assertEquals("SnippetHTML (2)", "<span class=\"context-left\">"
+                + "</span>" + "<span class=\"match\">" + "<mark>"
+                + "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
+                + "<span title=\"f/m:eins\">" + "<span title=\"f/y:one\">"
+                + "<span title=\"it/is:1\">"
+                + "<span title=\"x/o:erstens\">a</span>" + "</span>" + "</span>"
+                + "</span>" + "</span>"
+                + "<span xlink:title=\"x/rel:b\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
+                + "<span title=\"f/m:zwei\">" + "<span title=\"f/y:two\">"
+                + "<span title=\"it/is:2\">"
+                + "<span title=\"x/o:zweitens\">b</span>" + "</span>"
+                + "</span>" + "</span>" + "</span>"
+                + "<span title=\"f/m:drei\">" + "<span title=\"f/y:three\">"
+                + "<span title=\"it/is:3\">"
+                + "<span title=\"x/o:drittens\">c</span>" + "</span>"
+                + "</span>" + "</span>" + "<span xml:id=\"word-c1!d1-p3\">"
+                + "<span title=\"f/m:vier\">" + "<span title=\"f/y:four\">"
+                + "<span title=\"it/is:4\">"
+                + "<span title=\"x/o:viertens\">a</span>" + "</span>"
+                + "</span>" + "</span>" + "</span>" + "</mark>" + "</span>"
+                + "<span class=\"context-right\">" + "<span class=\"more\">"
+                + "</span>" + "</span>", km.getSnippetHTML());
     };
 
 
     @Test
-    public void indexExampleMultipleFoundries () throws IOException,
-            QueryException {
+    public void indexExampleMultipleFoundries ()
+            throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(createSimpleFieldDoc4());
         ki.commit();
 
         Match km = ki.getMatchInfo("match-c1!d4-p3-9", "tokens", "f", "m",
                 false, false);
-        assertEquals(
-                "f:m info",
-                km.getSnippetBrackets(),
+        assertEquals("f:m info", km.getSnippetBrackets(),
                 "... [[{f/m:vier:a}{f/m:fuenf:b}{f/m:sechs:c}{f/m:sieben:a}{f/m:acht:b}{f/m:neun:a}]] ...");
 
         km = ki.getMatchInfo("match-c1!d4-p3-9", "tokens", "f", null, false,
                 false);
-        assertEquals(
-                "f info",
-                km.getSnippetBrackets(),
+        assertEquals("f info", km.getSnippetBrackets(),
                 "... [[{f/m:vier:{f/y:four:a}}{f/m:fuenf:{f/y:five:b}}{f/m:sechs:{f/y:six:c}}{f/m:sieben:{f/y:seven:a}}{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}]] ...");
 
 
@@ -572,8 +553,8 @@
 
 
     @Test
-    public void indexExampleFailingFoundry () throws IOException,
-            QueryException {
+    public void indexExampleFailingFoundry ()
+            throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(createSimpleFieldDoc4());
         ki.commit();
@@ -583,8 +564,8 @@
         JsonNode res = mapper.readTree(km.toJsonString());
         assertEquals("c1", res.at("/corpusID").asText());
         assertEquals("d4", res.at("/docID").asText());
-        assertEquals("Invalid foundry requested", res.at("/errors/0/1")
-                .asText());
+        assertEquals("Invalid foundry requested",
+                res.at("/errors/0/1").asText());
     };
 
 
@@ -633,18 +614,12 @@
         assertTrue(res.at("/endMore").asBoolean());
         assertEquals("ca1", res.at("/corpusID").asText());
         assertEquals("da1", res.at("/docID").asText());
-        assertEquals("<span class=\"context-left\">"
-                + "<span class=\"more\">"
-                + "</span>"
-                + "</span>"
-                + "<span class=\"match\"><mark>"
-                +
+        assertEquals("<span class=\"context-left\">" + "<span class=\"more\">"
+                + "</span>" + "</span>" + "<span class=\"match\"><mark>" +
                 //                     "<span title=\"@:x/s:key:value\">"+
-                "<span title=\"f/m:acht\">"
-                + "<span title=\"f/y:eight\">"
+                "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
                 + "<span title=\"it/is:8\">"
-                + "<span title=\"x/o:achtens\">b</span>"
-                +
+                + "<span title=\"x/o:achtens\">b</span>" +
                 //                     "</span>"+
                 "</span>" + "</span>" + "</span>" + "<span title=\"f/m:neun\">"
                 + "<span title=\"f/y:nine\">" + "<span title=\"it/is:9\">"
@@ -662,9 +637,7 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("corpusID", "c1");
         fd.addString("ID", "d1");
-        fd.addTV(
-                "tokens",
-                "abcabcabac",
+        fd.addTV("tokens", "abcabcabac",
                 "[(0-1)s:a|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|>:x/rel:a$<b>32<i>4<s>0<s>0<s>0|_0$<i>0<i>1|-:t$<i>10]"
                         + "[(1-2)s:b|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|_1$<i>1<i>2]"
                         + "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2$<i>2<i>3|<>:base/s:s$<b>64<i>2<i>5<i>5]"
@@ -683,9 +656,7 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("corpusID", "c1");
         fd.addString("ID", "d1");
-        fd.addTV(
-                "tokens",
-                "abcabcabac",
+        fd.addTV("tokens", "abcabcabac",
                 "[(0-1)s:a|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|>:x/rel:a$<b>32<i>4<s>0<s>0<s>0|_0$<i>0<i>1|-:t$<i>10]"
                         + "[(1-2)s:b|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|>:x/rel:b$<b>32<i>4<s>0<s>0<s>0|_1$<i>1<i>2]"
                         + "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2$<i>2<i>3|<>:base/s:s$<b>64<i>2<i>5<i>5]"
@@ -704,9 +675,7 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("corpusID", "c1");
         fd.addString("ID", "d3");
-        fd.addTV(
-                "tokens",
-                "aa bb cc aa bb cc aa bb aa cc ",
+        fd.addTV("tokens", "aa bb cc aa bb cc aa bb aa cc ",
                 "[(0-2)s:aa|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|>:x/rel:a$<b>32<i>4<s>0<s>0<s>0|_0$<i>0<i>2|-:t$<i>10]"
                         + "[(3-5)s:bb|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|_1$<i>3<i>5]"
                         + "[(6-8)s:cc|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2$<i>6<i>8|<>:base/s:s$<b>64<i>6<i>14<i>5]"
@@ -725,9 +694,7 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("corpusID", "c1");
         fd.addString("ID", "d4");
-        fd.addTV(
-                "tokens",
-                "abcabcabac",
+        fd.addTV("tokens", "abcabcabac",
                 "[(0-1)s:a|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|>:x/rel:a$<b>32<i>4<s>0<s>0<s>0|_0$<i>0<i>1|-:t$<i>10]"
                         + "[(1-2)s:b|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|_1$<i>1<i>2]"
                         + "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2$<i>2<i>3|<>:base/s:s$<b>64<i>2<i>5<i>5]"
@@ -749,9 +716,7 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("corpusID", "ca1");
         fd.addString("ID", "da1");
-        fd.addTV(
-                "tokens",
-                "abcabcabac",
+        fd.addTV("tokens", "abcabcabac",
                 "[(0-1)s:a|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|_0$<i>0<i>1|-:t$<i>10]"
                         + "[(1-2)s:b|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|_1$<i>1<i>2]"
                         + "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2$<i>2<i>3|<>:base/s:s$<b>64<i>2<i>5<i>5]"
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
index fe3212d..932d448 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
@@ -52,10 +52,18 @@
         SpanQuery sq;
         Result kr;
 
-        sq = new SpanFocusQuery(new SpanClassQuery(new SpanNextQuery(
-                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
-                        (byte) 1), new SpanClassQuery(new SpanTermQuery(
-                        new Term("base", "s:c")), (byte) 2)), (byte) 3),
+        sq = new SpanFocusQuery(
+                new SpanClassQuery(
+                        new SpanNextQuery(
+                                new SpanClassQuery(
+                                        new SpanTermQuery(
+                                                new Term("base", "s:b")),
+                                        (byte) 1),
+                                new SpanClassQuery(
+                                        new SpanTermQuery(
+                                                new Term("base", "s:c")),
+                                        (byte) 2)),
+                        (byte) 3),
                 (byte) 3);
 
         kr = ki.search(sq, (short) 10);
@@ -63,12 +71,12 @@
         assertEquals("totalResults", kr.getTotalResults(), 2);
         assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "a[[{3:{1:b}{2:c}}]]abcaba ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "a[[{3:{1:b}{2:c}}]]abcaba ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 6, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abca[[{3:{1:b}{2:c}}]]abac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abca[[{3:{1:b}{2:c}}]]abac",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals("Document count", 1, ki.numberOf("base", "documents"));
         assertEquals("Token count", 10, ki.numberOf("base", "t"));
@@ -103,37 +111,38 @@
         assertEquals("StartPos (0)", 7, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
 
-        assertEquals("SnippetBrackets (0)", "... bcabca[[b{1:a}]]c", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "... bcabca[[b{1:a}]]c",
+                kr.getMatch(0).getSnippetBrackets());
 
-        assertEquals(
-                "Test no 'more' context",
+        assertEquals("Test no 'more' context",
                 "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\"><mark>b<mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\">c</span>",
                 kr.getMatch(0).getSnippetHTML());
 
 
-        sq = new SpanFocusQuery(new SpanNextQuery(new SpanTermQuery(new Term(
-                "base", "s:b")), new SpanClassQuery(new SpanTermQuery(new Term(
-                "base", "s:a")))));
+        sq = new SpanFocusQuery(new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:b")), new SpanClassQuery(
+                        new SpanTermQuery(new Term("base", "s:a")))));
         kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 1);
         assertEquals("StartPos (0)", 8, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "... cabcab[[{1:a}]]c", kr
-                .getMatch(0).getSnippetBrackets());
-        sq = new SpanFocusQuery(new SpanNextQuery(new SpanClassQuery(
-                new SpanTermQuery(new Term("base", "s:a")), (byte) 2),
+        assertEquals("SnippetBrackets (0)", "... cabcab[[{1:a}]]c",
+                kr.getMatch(0).getSnippetBrackets());
+        sq = new SpanFocusQuery(new SpanNextQuery(
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:a")),
+                        (byte) 2),
                 new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
-                        (byte) 3)), (byte) 3);
+                        (byte) 3)),
+                (byte) 3);
 
         kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 3);
         assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "a[[{3:b}]]cabcab ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "a[[{3:b}]]cabcab ...",
+                kr.getMatch(0).getSnippetBrackets());
 
 
         assertEquals(
@@ -142,8 +151,8 @@
 
         assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abca[[{3:b}]]cabac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abca[[{3:b}]]cabac",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals(
                 "<span class=\"context-left\">abca</span><span class=\"match\"><mark><mark class=\"class-3 level-0\">b</mark></mark></span><span class=\"context-right\">cabac</span>",
@@ -151,77 +160,82 @@
 
         assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
         assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
-        assertEquals("SnippetBrackets (2)", "... bcabca[[{3:b}]]ac", kr
-                .getMatch(2).getSnippetBrackets());
+        assertEquals("SnippetBrackets (2)", "... bcabca[[{3:b}]]ac",
+                kr.getMatch(2).getSnippetBrackets());
 
 
 
         // abcabcabac
-        sq = new SpanFocusQuery(
-                new SpanNextQuery(new SpanTermQuery(new Term("base", "s:a")),
-                        new SpanClassQuery(new SpanNextQuery(new SpanTermQuery(
-                                new Term("base", "s:b")), new SpanClassQuery(
-                                new SpanTermQuery(new Term("base", "s:a")))),
-                                (byte) 2)), (byte) 2);
+        sq = new SpanFocusQuery(new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:a")),
+                new SpanClassQuery(
+                        new SpanNextQuery(new SpanTermQuery(
+                                new Term("base", "s:b")),
+                                new SpanClassQuery(new SpanTermQuery(
+                                        new Term("base", "s:a")))),
+                        (byte) 2)),
+                (byte) 2);
 
         kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... bcabca[[{2:b{1:a}}]]c", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "... bcabca[[{2:b{1:a}}]]c",
+                kr.getMatch(0).getSnippetBrackets());
 
-        assertEquals(
-                "SnippetHTML (0) 1",
+        assertEquals("SnippetHTML (0) 1",
                 "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\"><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
                 kr.getMatch(0).getSnippetHTML());
 
         // Offset tokens
         kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... ca[[{2:b{1:a}}]]c", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "... ca[[{2:b{1:a}}]]c",
+                kr.getMatch(0).getSnippetBrackets());
 
 
 
         // Offset Characters
         kr = ki.search(sq, 0, (short) 10, false, (short) 1, false, (short) 0);
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... a[[{2:b{1:a}}]] ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "... a[[{2:b{1:a}}]] ...",
+                kr.getMatch(0).getSnippetBrackets());
 
-        assertEquals(
-                "SnippetHTML (0) 2",
+        assertEquals("SnippetHTML (0) 2",
                 "<span class=\"context-left\"><span class=\"more\"></span>a</span><span class=\"match\"><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
 
 
 
         // Don't match the expected class!
-        sq = new SpanFocusQuery(new SpanNextQuery(new SpanClassQuery(
-                new SpanTermQuery(new Term("base", "s:b")), (byte) 1),
+        sq = new SpanFocusQuery(new SpanNextQuery(
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
+                        (byte) 1),
                 new SpanClassQuery(new SpanTermQuery(new Term("base", "s:c")),
-                        (byte) 2)), (byte) 3);
+                        (byte) 2)),
+                (byte) 3);
 
         kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 0);
 
-        sq = new SpanFocusQuery(new SpanNextQuery(new SpanTermQuery(new Term(
-                "base", "s:a")), new SpanClassQuery(new SpanNextQuery(
-                new SpanTermQuery(new Term("base", "s:b")), new SpanTermQuery(
-                        new Term("base", "s:c"))))));
+        sq = new SpanFocusQuery(
+                new SpanNextQuery(new SpanTermQuery(new Term("base", "s:a")),
+                        new SpanClassQuery(new SpanNextQuery(
+                                new SpanTermQuery(new Term("base",
+                                        "s:b")),
+                                new SpanTermQuery(new Term("base", "s:c"))))));
 
         kr = ki.search(sq, (short) 2);
 
         assertEquals("totalResults", kr.getTotalResults(), 2);
         assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
-        assertEquals("SnippetBrackets (0)", "a[[{1:bc}]]abcaba ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "a[[{1:bc}]]abcaba ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
         assertEquals("EndPos (1)", 6, kr.getMatch(1).endPos);
-        assertEquals("SnippetBrackets (1)", "abca[[{1:bc}]]abac", kr
-                .getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)", "abca[[{1:bc}]]abac",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals(1, ki.numberOf("base", "documents"));
         assertEquals(10, ki.numberOf("base", "t"));
@@ -252,48 +266,42 @@
         kr = ki.search(sq, (short) 20);
 
         assertEquals("totalResults", kr.getTotalResults(), 7);
-        assertEquals(
-                "SnippetBrackets (0)",
+        assertEquals("SnippetBrackets (0)",
                 "<span class=\"context-left\"></span><span class=\"match\"><mark>a</mark></span><span class=\"context-right\">bcabca<span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
-        assertEquals("SnippetBrackets (0)", "[[a]]bcabca ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "[[a]]bcabca ...",
+                kr.getMatch(0).getSnippetBrackets());
 
-        assertEquals("SnippetBrackets (1)", "ab[[c]]abcaba ...", kr.getMatch(1)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetBrackets (1)",
+        assertEquals("SnippetBrackets (1)", "ab[[c]]abcaba ...",
+                kr.getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetBrackets (1)",
                 "<span class=\"context-left\">ab</span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\">abcaba<span class=\"more\"></span></span>",
                 kr.getMatch(1).getSnippetHTML());
 
-        assertEquals("SnippetBrackets (6)", "... abcaba[[c]]", kr.getMatch(6)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetBrackets (6)",
+        assertEquals("SnippetBrackets (6)", "... abcaba[[c]]",
+                kr.getMatch(6).getSnippetBrackets());
+        assertEquals("SnippetBrackets (6)",
                 "<span class=\"context-left\"><span class=\"more\"></span>abcaba</span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"></span>",
                 kr.getMatch(6).getSnippetHTML());
 
         kr = ki.search(sq, 0, (short) 20, true, (short) 0, true, (short) 0);
 
         assertEquals("totalResults", kr.getTotalResults(), 7);
-        assertEquals("SnippetBrackets (0)", "[[a]] ...", kr.getMatch(0)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (0)",
+        assertEquals("SnippetBrackets (0)", "[[a]] ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetHTML (0)",
                 "<span class=\"context-left\"></span><span class=\"match\"><mark>a</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
 
-        assertEquals("SnippetBrackets (1)", "... [[c]] ...", kr.getMatch(1)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetHTML (1)",
+        assertEquals("SnippetBrackets (1)", "... [[c]] ...",
+                kr.getMatch(1).getSnippetBrackets());
+        assertEquals("SnippetHTML (1)",
                 "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
                 kr.getMatch(1).getSnippetHTML());
 
-        assertEquals("SnippetBrackets (6)", "... [[c]]", kr.getMatch(6)
-                .getSnippetBrackets());
-        assertEquals(
-                "SnippetBrackets (6)",
+        assertEquals("SnippetBrackets (6)", "... [[c]]",
+                kr.getMatch(6).getSnippetBrackets());
+        assertEquals("SnippetBrackets (6)",
                 "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"></span>",
                 kr.getMatch(6).getSnippetHTML());
     };
@@ -318,16 +326,14 @@
 
         QueryBuilder kq = new QueryBuilder("base");
 
-        SpanQuery sq = kq._(
-                1,
-                kq.seq(kq.seg("s:b")).append(kq.seg("s:a"))
-                        .append(kq._(2, kq.seg("s:c")))).toQuery();
+        SpanQuery sq = kq._(1, kq.seq(kq.seg("s:b")).append(kq.seg("s:a"))
+                .append(kq._(2, kq.seg("s:c")))).toQuery();
 
         kr = ki.search(sq, 0, (short) 20, true, (short) 2, true, (short) 5);
 
         assertEquals("totalResults", kr.getTotalResults(), 1);
-        assertEquals("SnippetBrackets (0)", "... ca[[{1:ba{2:c}}]]", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("SnippetBrackets (0)", "... ca[[{1:ba{2:c}}]]",
+                kr.getMatch(0).getSnippetBrackets());
     };
 
 
@@ -349,10 +355,12 @@
         SpanQuery sq;
         Result kr;
 
-        sq = new SpanFocusQuery(new SpanNextQuery(new SpanClassQuery(
-                new SpanTermQuery(new Term("base", "s:a")), (byte) 2),
+        sq = new SpanFocusQuery(new SpanNextQuery(
+                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:a")),
+                        (byte) 2),
                 new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
-                        (byte) 3)), (byte) 3);
+                        (byte) 3)),
+                (byte) 3);
 
         kr = ki.search(sq, (short) 10);
 
@@ -364,10 +372,18 @@
         assertEquals("SnippetBrackets (0)", "a[[{3:b}]]cabcab ...",
                 km.getSnippetBrackets());
 
-        sq = new SpanFocusQuery(new SpanFocusQuery(new SpanNextQuery(
-                new SpanClassQuery(new SpanTermQuery(new Term("base", "s:a")),
-                        (byte) 2), new SpanClassQuery(new SpanTermQuery(
-                        new Term("base", "s:b")), (byte) 3)), (byte) 3),
+        sq = new SpanFocusQuery(
+                new SpanFocusQuery(
+                        new SpanNextQuery(
+                                new SpanClassQuery(
+                                        new SpanTermQuery(
+                                                new Term("base", "s:a")),
+                                        (byte) 2),
+                                new SpanClassQuery(
+                                        new SpanTermQuery(
+                                                new Term("base", "s:b")),
+                                        (byte) 3)),
+                        (byte) 3),
                 (byte) 2);
 
         kr = ki.search(sq, (short) 10);
@@ -411,10 +427,11 @@
         //        assertEquals(kr.getMatch(0).getSnippetBrackets(),
         //                "a[{2:{3:b}cab}]cabac");
 
-        sq = new SpanFocusQuery(new SpanWithinQuery(new SpanClassQuery(
-                new SpanElementQuery("base", "s"), (byte) 2),
+        sq = new SpanFocusQuery(new SpanWithinQuery(
+                new SpanClassQuery(new SpanElementQuery("base", "s"), (byte) 2),
                 new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")),
-                        (byte) 3)), (byte) 3);
+                        (byte) 3)),
+                (byte) 3);
 
         kr = ki.search(sq, (short) 10);
         assertEquals(kr.getSerialQuery(),
@@ -432,9 +449,8 @@
         // abcabcabac
         FieldDocument fd = new FieldDocument();
         fd.addTV("base", "abcabcabac",
-        // The payload should be ignored
-                "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]"
-                        + // |<>:p#0-10<i>9]" +
+                // The payload should be ignored
+                "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]" + // |<>:p#0-10<i>9]" +
                         "[(1-2)s:b|i:b|_1$<i>1<i>2|<>:s$<b>64<i>1<i>5<i>5]"
                         + "[(2-3)s:c|i:c|_2$<i>2<i>3|<>:s$<b>64<i>2<i>7<i>7]"
                         + "[(3-4)s:a|i:a|_3$<i>3<i>4]"
@@ -489,17 +505,18 @@
 
         // within(<p>, focus(3:within({2:<s>}, {3:a})))
         sq = new SpanWithinQuery(new SpanElementQuery("base", "p"),
-                new SpanFocusQuery(new SpanWithinQuery(new SpanClassQuery(
-                        new SpanElementQuery("base", "s"), (byte) 2),
-                        new SpanClassQuery(new SpanTermQuery(new Term("base",
-                                "s:a")), (byte) 3)), (byte) 3));
+                new SpanFocusQuery(new SpanWithinQuery(
+                        new SpanClassQuery(new SpanElementQuery("base", "s"),
+                                (byte) 2),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:a")),
+                                (byte) 3)),
+                        (byte) 3));
 
         // fail("Skipping may go horribly wrong! (Known issue)");
 
         Krill ks = new Krill(sq);
-        ks.getMeta()
-                .setStartIndex(0)
-                .setCount((short) 20)
+        ks.getMeta().setStartIndex(0).setCount((short) 20)
                 .setContext(new SearchContext(true, (short) 5, true, (short) 5))
         // .setCollection(kc)
         ;
@@ -507,16 +524,15 @@
         kr = ks.apply(ki);
         // kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
 
-        assertEquals(
-                kr.getSerialQuery(),
+        assertEquals(kr.getSerialQuery(),
                 "spanContain(<base:p />, focus(3: spanContain({2: <base:s />}, {3: base:s:a})))");
         assertEquals(12, kr.getTotalResults());
-        assertEquals("[a{2:bc{3:a}b}cabac]", kr.getMatch(0)
-                .getSnippetBrackets());
-        assertEquals("[ab{2:c{3:a}bcab}ac]", kr.getMatch(1)
-                .getSnippetBrackets());
-        assertEquals("[ab{2:cabc{3:a}}bac]", kr.getMatch(2)
-                .getSnippetBrackets());
+        assertEquals("[a{2:bc{3:a}b}cabac]",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("[ab{2:c{3:a}bcab}ac]",
+                kr.getMatch(1).getSnippetBrackets());
+        assertEquals("[ab{2:cabc{3:a}}bac]",
+                kr.getMatch(2).getSnippetBrackets());
     };
 
 };
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
index 7054aa4..c6363e5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
@@ -53,9 +53,7 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV(
-                "base",
-                "text",
+        fd.addTV("base", "text",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
                         + "[(1-2)s:b|s:c|_2$<i>1<i>2]"
                         + "[(2-3)s:c|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
@@ -69,9 +67,7 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "base",
-                "text",
+        fd.addTV("base", "text",
                 "[(0-1)s:c|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
                         + "[(1-2)s:c|s:e|_2$<i>1<i>2]"
                         + "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
@@ -85,9 +81,7 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV(
-                "base",
-                "text",
+        fd.addTV("base", "text",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
                         + "[(1-2)s:b|s:e|_2$<i>1<i>2]"
                         + "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
@@ -115,7 +109,7 @@
 
     /**
      * Unordered, same sentence
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki = new KrillIndex();
@@ -146,7 +140,7 @@
      * Unordered
      * Two constraints
      * Three constraints
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki = new KrillIndex();
@@ -199,7 +193,7 @@
     /**
      * Multiple documents
      * Ensure same doc (inner term span)
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki = new KrillIndex();
@@ -241,7 +235,7 @@
 
     /**
      * Skip to
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         ki = new KrillIndex();
@@ -258,8 +252,8 @@
         SpanQuery mdq;
         mdq = createQuery("s:b", "s:c", constraints, false);
 
-        SpanQuery sq = new SpanNextQuery(mdq, new SpanTermQuery(new Term(
-                "base", "s:e")));
+        SpanQuery sq = new SpanNextQuery(mdq,
+                new SpanTermQuery(new Term("base", "s:e")));
         kr = ki.search(sq, (short) 10);
 
         assertEquals((long) 2, kr.getTotalResults());
@@ -274,7 +268,7 @@
 
     /**
      * Same tokens: ordered and unordered yield the same results
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         ki = new KrillIndex();
@@ -307,7 +301,7 @@
     /**
      * Exclusion
      * Gaps
-     * */
+     */
     @Test
     public void testCase6 () throws IOException {
         ki = new KrillIndex();
@@ -351,7 +345,7 @@
 
     /**
      * Exclusion, multiple documents
-     * */
+     */
     @Test
     public void testCase7 () throws IOException {
         ki = new KrillIndex();
@@ -361,8 +355,8 @@
         SpanQuery sx = new SpanTermQuery(new Term("base", "s:b"));
         SpanQuery sy = new SpanTermQuery(new Term("base", "s:c"));
         // Second constraint
-        SpanDistanceQuery sq = new SpanDistanceQuery(sx, sy, createConstraint(
-                "s", 0, 0, false, true), true);
+        SpanDistanceQuery sq = new SpanDistanceQuery(sx, sy,
+                createConstraint("s", 0, 0, false, true), true);
         kr = ki.search(sq, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
         // 0-1, 1-2, 6-7
@@ -383,8 +377,8 @@
 
 
         // Third constraint
-        sq = new SpanDistanceQuery(sx, sy, createConstraint("p", 0, 0, false,
-                true), true);
+        sq = new SpanDistanceQuery(sx, sy,
+                createConstraint("p", 0, 0, false, true), true);
         kr = ki.search(sq, (short) 10);
         assertEquals((long) 1, kr.getTotalResults());
         // 6-7
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
index 561d6bb..16ced0a 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
@@ -96,19 +96,13 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "abcabcabac",
-                "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]"
-                        + "[(1-2)s:b|i:b|_1$<i>1<i>2]"
-                        + "[(2-3)s:c|i:c|_2$<i>2<i>3]"
-                        + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:x$<b>64<i>3<i>4<i>4<b>0|<>:x$<b>64<i>3<i>7<i>7<b>0]"
-                        + "[(4-5)s:b|i:b|_4$<i>4<i>5]"
-                        + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
-                        + "[(6-7)s:a|i:a|_6$<i>6<i>7]"
-                        + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
-                        + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
-                        + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
+        fd.addTV("base", "abcabcabac", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]"
+                + "[(1-2)s:b|i:b|_1$<i>1<i>2]" + "[(2-3)s:c|i:c|_2$<i>2<i>3]"
+                + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:x$<b>64<i>3<i>4<i>4<b>0|<>:x$<b>64<i>3<i>7<i>7<b>0]"
+                + "[(4-5)s:b|i:b|_4$<i>4<i>5]" + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
+                + "[(6-7)s:a|i:a|_6$<i>6<i>7]" + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
+                + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+                + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
         ki.addDoc(fd);
 
         ki.commit();
@@ -136,7 +130,8 @@
                 + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
                 + "[(4-5)s:b|i:b|_4$<i>4<i>5]" + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
                 + "[(6-7)s:a|i:a|_6$<i>6<i>7]" + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
-                + "[(8-9)s:a|i:a|_8$<i>8<i>9]" + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
+                + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+                + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
         ki.addDoc(fd);
 
         ki.commit();
@@ -177,7 +172,8 @@
                 + "[(3-4)s:x|i:x|_3$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
                 + "[(4-5)s:b|i:b|_4$<i>4<i>5]" + "[(5-6)s:z|i:z|_5$<i>5<i>6]"
                 + "[(6-7)s:x|i:x|_6$<i>6<i>7]" + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
-                + "[(8-9)s:x|i:x|_8$<i>8<i>9]" + "[(9-10)s:z|i:z|_9$<i>9<i>10]");
+                + "[(8-9)s:x|i:x|_8$<i>8<i>9]"
+                + "[(9-10)s:z|i:z|_9$<i>9<i>10]");
         ki.addDoc(fd);
         ki.commit();
 
@@ -211,7 +207,7 @@
     /**
      * Multiple atomic indices
      * Skip to a greater doc#
-     * */
+     */
     @Test
     public void indexExample5 () throws IOException {
         KrillIndex ki = new KrillIndex();
@@ -221,8 +217,9 @@
         ki.addDoc(createFieldDoc3());
         ki.commit();
 
-        SpanQuery sq = new SpanNextQuery(new SpanTermQuery(new Term("base",
-                "s:d")), new SpanTermQuery(new Term("base", "s:b")));
+        SpanQuery sq = new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:d")),
+                new SpanTermQuery(new Term("base", "s:b")));
         Result kr = ki.search(sq, (short) 10);
 
         assertEquals("totalResults", kr.getTotalResults(), 2);
@@ -255,9 +252,10 @@
         ki.addDoc(createFieldDoc3());
         ki.commit();
 
-        SpanQuery sq = new SpanNextQuery(new SpanTermQuery(new Term("base",
-                "s:c")), new SpanNextQuery(new SpanTermQuery(new Term("base",
-                "s:d")), new SpanTermQuery(new Term("base", "s:b"))));
+        SpanQuery sq = new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:c")),
+                new SpanNextQuery(new SpanTermQuery(new Term("base", "s:d")),
+                        new SpanTermQuery(new Term("base", "s:b"))));
 
         Result kr = ki.search(sq, (short) 10);
         assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -265,12 +263,16 @@
         assertEquals("StartPos", 0, kr.getMatch(0).startPos);
         assertEquals("EndPos", 3, kr.getMatch(0).endPos);
 
-        sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:c")),
-                new SpanNextQuery(new SpanFocusQuery(new SpanClassQuery(
-                        new SpanTermQuery(new Term("base", "s:d")), (byte) 1),
-                        (byte) 1), new SpanFocusQuery(new SpanClassQuery(
-                        new SpanTermQuery(new Term("base", "s:b")), (byte) 2),
-                        (byte) 2)));
+        sq = new SpanNextQuery(
+                new SpanTermQuery(
+                        new Term("base", "s:c")),
+                new SpanNextQuery(
+                        new SpanFocusQuery(new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:d")),
+                                (byte) 1), (byte) 1),
+                        new SpanFocusQuery(new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:b")),
+                                (byte) 2), (byte) 2)));
 
         kr = ki.search(sq, (short) 10);
         assertEquals("doc-number", 2, kr.getMatch(0).getLocalDocID());
@@ -333,9 +335,10 @@
         ki.addDoc(createFieldDoc1());
         ki.commit();
 
-        SpanQuery sq = new SpanNextQuery(new SpanOrQuery(new SpanTermQuery(
-                new Term("base", "s:a")), new SpanTermQuery(new Term("base",
-                "s:b"))), new SpanTermQuery(new Term("base", "s:c")));
+        SpanQuery sq = new SpanNextQuery(
+                new SpanOrQuery(new SpanTermQuery(new Term("base", "s:a")),
+                        new SpanTermQuery(new Term("base", "s:b"))),
+                new SpanTermQuery(new Term("base", "s:c")));
 
         Result kr = ki.search(sq, (short) 10);
 
@@ -349,12 +352,12 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("base", "bcbadb", "[(0-1)s:b|i:b|_0$<i>0<i>1]"
-                + "[(1-2)s:c|i:c|s:b|_1$<i>1<i>2]"
-                + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
-                + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:e$<b>64<i>3<i>6<i>6<b>0]"
-                + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]"
-                + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
+        fd.addTV("base", "bcbadb",
+                "[(0-1)s:b|i:b|_0$<i>0<i>1]" + "[(1-2)s:c|i:c|s:b|_1$<i>1<i>2]"
+                        + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
+                        + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:e$<b>64<i>3<i>6<i>6<b>0]"
+                        + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]"
+                        + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
         return fd;
     }
 
@@ -362,10 +365,11 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV("base", "caba", "[(0-1)s:c|i:c|_0$<i>0<i>1]"
-                + "[(1-2)s:a|i:a|s:c|_1$<i>1<i>2|<>:e$<b>64<i>1<i>3<i>3<b>0]"
-                + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
-                + "[(3-4)s:a|i:a|_3$<i>3<i>4]");
+        fd.addTV("base", "caba",
+                "[(0-1)s:c|i:c|_0$<i>0<i>1]"
+                        + "[(1-2)s:a|i:a|s:c|_1$<i>1<i>2|<>:e$<b>64<i>1<i>3<i>3<b>0]"
+                        + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
+                        + "[(3-4)s:a|i:a|_3$<i>3<i>4]");
         return fd;
     }
 
@@ -373,10 +377,10 @@
     private FieldDocument createFieldDoc3 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("base", "cdbd", "[(0-1)s:c|i:c|_0$<i>0<i>1]"
-                + "[(1-2)s:d|i:d|_1$<i>1<i>2]"
-                + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
-                + "[(3-4)s:d|i:d|_3$<i>3<i>4]");
+        fd.addTV("base", "cdbd",
+                "[(0-1)s:c|i:c|_0$<i>0<i>1]" + "[(1-2)s:d|i:d|_1$<i>1<i>2]"
+                        + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
+                        + "[(3-4)s:d|i:d|_3$<i>3<i>4]");
 
         return fd;
     }
@@ -385,9 +389,7 @@
     private FieldDocument createFieldDoc4 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-3");
-        fd.addTV(
-                "base",
-                "bcbadb",
+        fd.addTV("base", "bcbadb",
                 "[(0-1)s:b|i:b|_0$<i>0<i>1]"
                         + "[(1-2)s:c|i:c|s:b|<>:s$<b>64<i>1<i>3<i>3<b>0|_1$<i>1<i>2<b>0]"
                         + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
index 09fd4a5..47a6117 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
@@ -40,8 +40,10 @@
     @Test
     public void testCase1 () throws IOException, QueryException {
         QueryBuilder kq = new QueryBuilder("tokens");
-        ks = new Krill(kq.within(kq.tag("base/s:s"),
-                kq.seq(kq.re("s:.*")).append(kq._(kq.re("s:.*")))).toQuery());
+        ks = new Krill(kq
+                .within(kq.tag("base/s:s"),
+                        kq.seq(kq.re("s:.*")).append(kq._(kq.re("s:.*"))))
+                .toQuery());
         ks.getMeta().setTimeOut(10000);
         kr = ks.apply(ki);
         System.err.println(kr.toJsonString());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
index f1aeb02..fc4d57c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
@@ -43,8 +43,8 @@
 
         SpanFocusQuery sfq1 = new SpanFocusQuery(snq1, (byte) 2);
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", "<:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:child-of")), true);
         // SpanSegmentQuery ssq = new SpanSegmentQuery(srq, sfq1,
         // true);
         // SpanFocusQuery sfq2 = new SpanFocusQuery(ssq, (byte) 1);
@@ -94,8 +94,9 @@
     @Test
     public void testCase2 () throws IOException, QueryException {
 
-        String filepath = getClass().getResource(
-                "/queries/reference/distance-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/reference/distance-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -108,7 +109,8 @@
                         + "focus(3: spanDistance(focus(1: spanDistance({1: <tokens:vb />}, "
                         + "{2: <tokens:prp />}, [(w[1:2], notOrdered, notExcluded)])), "
                         + "{3: <tokens:nn />}, [(w[1:3], notOrdered, notExcluded)]))))"
-                        + ")), 2)", sq.toString());
+                        + ")), 2)",
+                sq.toString());
 
         SpanElementQuery seq1 = new SpanElementQuery("tokens", "vb");
         // new SpanTermQuery(new Term("tokens", "c:vb"));
@@ -129,8 +131,9 @@
         SpanFocusQuery sfq2 = new SpanFocusQuery(sdq2, (byte) 3);
 
         // nn -> prp
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("tokens", ">:stanford/d:tag")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("tokens", ">:stanford/d:tag")),
+                true);
         SpanRelationMatchQuery rq = new SpanRelationMatchQuery(srq, sfq2, scq2,
                 true);
 
@@ -159,8 +162,8 @@
 
         SpanFocusQuery sfq3 = new SpanFocusQuery(ref, (byte) 1);
         // vp -> nn
-        SpanRelationMatchQuery rq2 = new SpanRelationMatchQuery(srq, sfq3,
-                scq3, true);
+        SpanRelationMatchQuery rq2 = new SpanRelationMatchQuery(srq, sfq3, scq3,
+                true);
 
         SpanReferenceQuery ref2 = new SpanReferenceQuery(rq2, (byte) 3, true);
 
@@ -185,8 +188,9 @@
         ki.addDoc(createFieldDoc0());
         ki.commit();
 
-        String filepath = getClass().getResource(
-                "/queries/reference/distance-multiple-references.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/distance-multiple-references.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -224,8 +228,9 @@
         ki.addDoc(createFieldDoc1());
         ki.commit();
 
-        String filepath = getClass().getResource(
-                "/queries/reference/distance-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/reference/distance-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -241,8 +246,7 @@
     public static FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "tokens",
+        fd.addTV("tokens",
                 "Frankenstein, treat my daughter well. She is the one that saved your master who you hold so dear.",
 
                 "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
@@ -276,8 +280,7 @@
     public static FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV(
-                "tokens",
+        fd.addTV("tokens",
                 "Frankenstein, treat my daughter well. She is the one that saved your master who you hold so dear.",
 
                 "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
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 9bda6d1..46580ee 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
@@ -22,8 +22,7 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
+        fd.addTV("base",
                 "affe afffe baum baumgarten steingarten franz hans haus efeu effe",
                 "[(0-4)s:affe|_0$<i>0<i>4|-:t$<i>10]"
                         + "[(5-10)s:afffe|_1$<i>5<i>10]"
@@ -41,48 +40,48 @@
 
         QueryBuilder kq = new QueryBuilder("base");
         SpanQueryWrapper sqw = kq.re("s:af*e");
-        assertEquals("SpanMultiTermQueryWrapper(base:/s:af*e/)", sqw.toQuery()
-                .toString());
+        assertEquals("SpanMultiTermQueryWrapper(base:/s:af*e/)",
+                sqw.toQuery().toString());
 
         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());
+        assertEquals("affe [[afffe]] baum ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
-        assertEquals("... baum [[baumgarten]] steingarten ...", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("... afffe [[baum]] baumgarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... baum [[baumgarten]] steingarten ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
-        assertEquals("... baumgarten [[steingarten]] franz ...", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("... baum [[baumgarten]] steingarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... baumgarten [[steingarten]] franz ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
+        assertEquals("... franz [[hans]] haus ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... hans [[haus]] efeu ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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)
-                .getSnippetBrackets());
+        assertEquals("affe [[afffe]] baum ...",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals("... efeu [[effe]]", kr.getMatch(2).getSnippetBrackets());
     };
 
@@ -93,8 +92,7 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
+        fd.addTV("base",
                 "affe afffe baum baumgarten steingarten franz hans haus efeu effe",
                 "[(0-4)s:affe|_0$<i>0<i>4|-:t$<i>10]"
                         + "[(5-10)s:afffe|_1$<i>5<i>10]"
@@ -112,16 +110,16 @@
 
         QueryBuilder kq = new QueryBuilder("base");
         SpanQueryWrapper sq = kq.wc("s:af*e");
-        assertEquals("SpanMultiTermQueryWrapper(base:s:af*e)", sq.toQuery()
-                .toString());
+        assertEquals("SpanMultiTermQueryWrapper(base:s:af*e)",
+                sq.toQuery().toString());
 
         Krill ks = _newKrill(sq);
 
         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());
+        assertEquals("affe [[afffe]] baum ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         ks = _newKrill(new QueryBuilder("base").wc("s:baum.*"));
         kr = ki.search(ks);
@@ -131,26 +129,26 @@
         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());
+        assertEquals("... afffe [[baum]] baumgarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... baum [[baumgarten]] steingarten ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
+        assertEquals("... baum [[baumgarten]] steingarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... baumgarten [[steingarten]] franz ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
+        assertEquals("... franz [[hans]] haus ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... hans [[haus]] efeu ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         ks = _newKrill(new QueryBuilder("base").wc("s:?ff?"));
         kr = ki.search(ks);
@@ -166,8 +164,7 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
+        fd.addTV("base",
                 "AfFe aFfFE Baum Baumgarten SteinGarten franZ HaNs Haus Efeu effe",
                 "[(0-4)s:AfFe|i:affe|_0$<i>0<i>4|-:t$<i>10]"
                         + "[(5-10)s:aFfFE|i:afffe|_1$<i>5<i>10]"
@@ -185,15 +182,15 @@
 
         QueryBuilder kq = new QueryBuilder("base");
         SpanQueryWrapper sqw = kq.re("s:Af*e", true);
-        assertEquals("SpanMultiTermQueryWrapper(base:/i:af*e/)", sqw.toQuery()
-                .toString());
+        assertEquals("SpanMultiTermQueryWrapper(base:/i:af*e/)",
+                sqw.toQuery().toString());
 
         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());
+        assertEquals("AfFe [[aFfFE]] Baum ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         ks = _newKrill(new QueryBuilder("base").re("s:Af.*e"));
         kr = ki.search(ks);
@@ -203,39 +200,39 @@
         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());
+        assertEquals("... aFfFE [[Baum]] Baumgarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... Baum [[Baumgarten]] SteinGarten ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
+        assertEquals("... Baum [[Baumgarten]] SteinGarten ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... Baumgarten [[SteinGarten]] franZ ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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());
+        assertEquals("... Baum [[Baumgarten]] SteinGarten ...",
+                kr.getMatch(0).getSnippetBrackets());
 
         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());
+        assertEquals("... franZ [[HaNs]] Haus ...",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("... HaNs [[Haus]] Efeu ...",
+                kr.getMatch(1).getSnippetBrackets());
 
         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)
-                .getSnippetBrackets());
+        assertEquals("AfFe [[aFfFE]] Baum ...",
+                kr.getMatch(1).getSnippetBrackets());
         assertEquals("... Efeu [[effe]]", kr.getMatch(2).getSnippetBrackets());
     };
 
@@ -246,8 +243,7 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
+        fd.addTV("base",
                 "affe afffe baum baumgarten steingarten franz hans haus efeu effe",
                 "[(0-4)s:affe|_0$<i>0<i>4|-:t$<i>10]"
                         + "[(5-10)s:afffe|_1$<i>5<i>10]"
@@ -276,8 +272,8 @@
 
         Result kr = ki.search(ks);
         assertEquals((long) 1, kr.getTotalResults());
-        assertEquals("[[affe afffe]] baum ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("[[affe afffe]] baum ...",
+                kr.getMatch(0).getSnippetBrackets());
     };
 
 
@@ -287,8 +283,7 @@
 
         // abcabcabac
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
+        fd.addTV("base",
                 "affe afffe baum baumgarten steingarten franz hans haus efeu effe",
                 "[(0-4)s:affe|_0$<i>0<i>4|-:t$<i>10]"
                         + "[(5-10)s:afffe|_1$<i>5<i>10]"
@@ -305,9 +300,10 @@
         ki.commit();
 
         QueryBuilder kq = new QueryBuilder("base");
-        SpanQuery sq = kq.contains(
-                kq.seq(kq.re("s:a.*e")).append(kq.re("s:af*e")),
-                kq.seg("s:affe")).toQuery();
+        SpanQuery sq = kq
+                .contains(kq.seq(kq.re("s:a.*e")).append(kq.re("s:af*e")),
+                        kq.seg("s:affe"))
+                .toQuery();
         assertEquals(
                 "spanContain(spanNext(SpanMultiTermQueryWrapper(base:/s:a.*e/), SpanMultiTermQueryWrapper(base:/s:af*e/)), base:s:affe)",
                 sq.toString());
@@ -317,8 +313,8 @@
 
         Result kr = ki.search(ks);
         assertEquals((long) 1, kr.getTotalResults());
-        assertEquals("[[affe afffe]] baum ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("[[affe afffe]] baum ...",
+                kr.getMatch(0).getSnippetBrackets());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
index a1d615d..63491a2 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
@@ -75,24 +75,20 @@
     public static FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV(
-                "base",
-                "ceccecdeed",
-                "[(0-1)s:c$<s>1|_0$<i>0<i>1"
-                        + "|>:xip/syntax-dep_rel$<b>32<i>6<s>1<s>1<s>0]"
-                        + "[(1-2)s:e$<s>1|_1$<i>1<i>2|"
-                        + "<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1<s>0|"
-                        + ">:xip/syntax-dep_rel$<b>32<i>4<s>1<s>1<s>0]"
-                        + "[(2-3)s:c|_2$<i>2<i>3]"
-                        + "[(3-4)s:c$<s>1|s:b$<s>2|_3$<i>3<i>4|<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1<s>0]"
-                        + "[(4-5)s:e$<s>1|s:d$<s>2|_4$<i>4<i>5|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0]"
-                        + "[(5-6)s:c|_5$<i>5<i>6]"
-                        + "[(6-7)s:d$<s>1|_6$<i>6<i>7|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0]"
-                        + "[(7-8)s:e|_7$<i>7<i>8]"
-                        + "[(8-9)s:e|s:b|_8$<i>8<i>9]"
-                        + "[(9-10)s:d$<s>1|_9$<i>9<i>10|"
-                        + ">:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0|"
-                        + ">:xip/syntax-dep_rel$<b>32<i>3<s>1<s>1<s>0]");
+        fd.addTV("base", "ceccecdeed", "[(0-1)s:c$<s>1|_0$<i>0<i>1"
+                + "|>:xip/syntax-dep_rel$<b>32<i>6<s>1<s>1<s>0]"
+                + "[(1-2)s:e$<s>1|_1$<i>1<i>2|"
+                + "<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1<s>0|"
+                + ">:xip/syntax-dep_rel$<b>32<i>4<s>1<s>1<s>0]"
+                + "[(2-3)s:c|_2$<i>2<i>3]"
+                + "[(3-4)s:c$<s>1|s:b$<s>2|_3$<i>3<i>4|<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1<s>0]"
+                + "[(4-5)s:e$<s>1|s:d$<s>2|_4$<i>4<i>5|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0]"
+                + "[(5-6)s:c|_5$<i>5<i>6]"
+                + "[(6-7)s:d$<s>1|_6$<i>6<i>7|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0]"
+                + "[(7-8)s:e|_7$<i>7<i>8]" + "[(8-9)s:e|s:b|_8$<i>8<i>9]"
+                + "[(9-10)s:d$<s>1|_9$<i>9<i>10|"
+                + ">:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1<s>0|"
+                + ">:xip/syntax-dep_rel$<b>32<i>3<s>1<s>1<s>0]");
         return fd;
     }
 
@@ -100,9 +96,7 @@
     public static FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV(
-                "base",
-                "ceccecdeed",
+        fd.addTV("base", "ceccecdeed",
                 "[(0-1)s:c$<s>2|<>:p$<b>64<i>0<i>3<i>3<b>0<s>1|_0$<i>0<i>1|"
                         + ">:xip/syntax-dep_rel$<b>35<i>0<i>1<i>1<i>2<i>3<i>6<i>9<s>1<s>1<s>2|"
                         + ">:xip/syntax-dep_rel$<b>33<i>1<i>2<i>6<i>9<s>2<s>1<s>0|"
@@ -116,8 +110,7 @@
                         + ">:xip/syntax-dep_rel$<b>34<i>3<i>4<i>9<i>9<s>1<s>1<s>0|"
                         + "<:xip/syntax-dep_rel$<b>35<i>3<i>4<i>4<i>5<i>9<i>1<i>3<s>1<s>1<s>2|"
                         + "<:xip/syntax-dep_rel$<b>34<i>5<i>6<i>9<i>1<s>1<s>2<s>0|"
-                        + "@:func=obj$<b>18<s>2]"
-                        + "[(7-8)s:e|_7$<i>7<i>8]"
+                        + "@:func=obj$<b>18<s>2]" + "[(7-8)s:e|_7$<i>7<i>8]"
                         + "[(8-9)s:e|s:b|_8$<i>8<i>9]"
                         + "[(9-10)s:d$<s>1|_9$<i>9<i>10|<"
                         + ":xip/syntax-dep_rel$<b>33<i>6<i>7<i>6<i>9<s>2<s>1<s>0]");
@@ -128,9 +121,7 @@
     public static FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV(
-                "base",
-                "Ich kaufe die Blümen für meine Mutter.",
+        fd.addTV("base", "Ich kaufe die Blümen für meine Mutter.",
                 "[(0-3)s:Ich|_0$<i>0<i>3|pos:NN$<s>1|<>:s$<b>64<i>0<i>38<i>7<b>0<s>2|<>:np$<b>64<i>0<i>3<i>1<b>0<s>3|"
                         + ">:child-of$<b>33<i>0<i>38<i>0<i>7<s>3<s>2<s>4|"
                         + ">:child-of$<b>33<i>0<i>3<i>0<i>1<s>1<s>3<s>0|"
@@ -203,15 +194,16 @@
 
     /**
      * Relations: token to token, token to span, span to span
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
         ki.commit();
 
-        SpanRelationQuery sq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:xip/syntax-dep_rel")), true);
+        SpanRelationQuery sq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:xip/syntax-dep_rel")),
+                true);
         kr = ki.search(sq, (short) 10);
 
         assertEquals((long) 7, kr.getTotalResults());
@@ -244,15 +236,16 @@
 
     /**
      * Relation span to token
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
         ki.commit();
 
-        SpanRelationQuery sq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", "<:xip/syntax-dep_rel")), true);
+        SpanRelationQuery sq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:xip/syntax-dep_rel")),
+                true);
         kr = ki.search(sq, (short) 10);
 
         assertEquals((long) 7, kr.getTotalResults());
@@ -281,15 +274,15 @@
 
     /**
      * Relations only
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         // child-of relations
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         kr = ki.search(srq, (short) 20);
 
         assertEquals((long) 13, kr.getTotalResults());
@@ -310,14 +303,14 @@
 
     /**
      * Relations only with/out attribute
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
 
         SpanFocusQuery fq = new SpanFocusQuery(srq, srq.getTempClassNumbers());
         fq.setMatchTemporaryClass(true);
@@ -328,8 +321,8 @@
         // System.out.println(m.getStartPos() + " " + m.getEndPos());
         // }
 
-        SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:func=sbj")), true);
+        SpanAttributeQuery saq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:func=sbj")), true);
         // kr = ki.search(saq, (short) 20);
 
         // child-of with attr func=sbj
@@ -341,8 +334,10 @@
         // assertEquals(7, kr.getMatch(0).getEndPos());
 
         // child-of without attr func=sbj
-        wq = new SpanWithAttributeQuery(fq, new SpanAttributeQuery(
-                new SpanTermQuery(new Term("base", "@:func=sbj")), true, true),
+        wq = new SpanWithAttributeQuery(fq,
+                new SpanAttributeQuery(
+                        new SpanTermQuery(new Term("base", "@:func=sbj")), true,
+                        true),
                 true);
         kr = ki.search(wq, (short) 20);
         assertEquals((long) 12, kr.getTotalResults());
@@ -352,7 +347,7 @@
     /**
      * Relation directions <br/>
      * Relation with specific sources, return the sources
-     * */
+     */
     @Test
     public void testCase6 () throws IOException {
         ki.addDoc(createFieldDoc2());
@@ -362,8 +357,8 @@
         SpanElementQuery seq1 = new SpanElementQuery("base", "np");
         SpanClassQuery scq1 = new SpanClassQuery(seq1, (byte) 1);
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
 
         SpanRelationMatchQuery rm = new SpanRelationMatchQuery(srq, scq1, true);
         SpanFocusQuery rv = new SpanFocusQuery(rm, (byte) 1);
@@ -386,8 +381,8 @@
         assertEquals(7, kr.getMatch(3).getEndPos());
 
         // return all parents that are NP
-        srq = new SpanRelationQuery(new SpanTermQuery(new Term("base",
-                "<:child-of")), true);
+        srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:child-of")), true);
         rm = new SpanRelationMatchQuery(srq, scq1, true);
         rv = new SpanFocusQuery(rm, (byte) 1);
         kr = ki.search(rv, (short) 10);
@@ -412,15 +407,15 @@
 
     /**
      * Dependency relations with attribute
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
         // target of a dependency relation
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", "<:dep")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:dep")), true);
         kr = ki.search(srq, (short) 10);
         assertEquals((long) 6, kr.getTotalResults());
 
@@ -432,8 +427,8 @@
         kr = ki.search(fq, (short) 10);
         assertEquals((long) 6, kr.getTotalResults());
 
-        SpanAttributeQuery aq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:func=head")), true);
+        SpanAttributeQuery aq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:func=head")), true);
         kr = ki.search(aq, (short) 10);
 
         // dependency relation, which is also a head
@@ -452,7 +447,7 @@
 
     /**
      * Relation with specific sources, return any targets
-     * */
+     */
     @Test
     public void testCase7 () throws IOException {
         ki.addDoc(createFieldDoc2());
@@ -462,8 +457,8 @@
         SpanElementQuery seq1 = new SpanElementQuery("base", "np");
         SpanClassQuery scq1 = new SpanClassQuery(seq1, (byte) 1);
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setTargetClass((byte) 2);
 
         SpanRelationMatchQuery rm = new SpanRelationMatchQuery(srq, scq1, true);
@@ -498,7 +493,7 @@
     /**
      * Relations whose source/target do not embed
      * its counterparts.
-     * */
+     */
     @Test
     public void testCase8 () throws IOException {
         ki.addDoc(createFieldDoc2());
@@ -506,10 +501,10 @@
 
         //return source of dep relations to pos:NN
 
-        SpanTermWithIdQuery tq = new SpanTermWithIdQuery(new Term("base",
-                "pos:NN"), true);
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", "<:dep")), true);
+        SpanTermWithIdQuery tq = new SpanTermWithIdQuery(
+                new Term("base", "pos:NN"), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:dep")), true);
         srq.setSourceClass((byte) 1);
         SpanRelationMatchQuery rm = new SpanRelationMatchQuery(srq, tq, true);
         SpanQuery rv = new SpanFocusQuery(rm, (byte) 1);
@@ -549,7 +544,7 @@
      * Relation with specific sources and targets, return the sources
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase9 () throws IOException {
         ki.addDoc(createFieldDoc2());
@@ -558,8 +553,8 @@
         // return all children of np
         SpanElementQuery seq1 = new SpanElementQuery("base", "np");
         SpanClassQuery scq1 = new SpanClassQuery(seq1, (byte) 1);
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", "<:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", "<:child-of")), true);
         srq.setSourceClass((byte) 2);
         SpanRelationMatchQuery rm = new SpanRelationMatchQuery(srq, scq1, true);
         SpanFocusQuery rv = new SpanFocusQuery(rm, (byte) 2);
@@ -594,14 +589,14 @@
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanTermWithIdQuery tiq = new SpanTermWithIdQuery(new Term("base",
-                "pos:ART"), true);
+        SpanTermWithIdQuery tiq = new SpanTermWithIdQuery(
+                new Term("base", "pos:ART"), true);
         SpanClassQuery scq1 = new SpanClassQuery(tiq, (byte) 1);
         SpanElementQuery seq = new SpanElementQuery("base", "np");
         SpanClassQuery scq2 = new SpanClassQuery(seq, (byte) 2);
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setSourceClass((byte) 1);
         srq.setTargetClass((byte) 2);
 
@@ -630,8 +625,8 @@
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanTermWithIdQuery tiq = new SpanTermWithIdQuery(new Term("base",
-                "pos:ART"), true);
+        SpanTermWithIdQuery tiq = new SpanTermWithIdQuery(
+                new Term("base", "pos:ART"), true);
         SpanClassQuery scq1 = new SpanClassQuery(tiq, (byte) 1);
 
         kr = ki.search(scq1, (short) 10);
@@ -641,8 +636,8 @@
         assertEquals(5, kr.getMatch(1).getStartPos());
         assertEquals(6, kr.getMatch(1).getEndPos());
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setSourceClass((byte) 1);
         srq.setTargetClass((byte) 2);
 
@@ -721,19 +716,19 @@
     /**
      * Relation whose nodes have a specific attribute.
      * 
-     * */
+     */
     @Test
     public void testCase10a () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanAttributeQuery aq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:case=accusative")), true);
+        SpanAttributeQuery aq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:case=accusative")), true);
         kr = ki.search(aq, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setSourceClass((byte) 1);
         srq.setTargetClass((byte) 2);
         kr = ki.search(srq, (short) 20);
@@ -741,7 +736,8 @@
 
         // Matching relation source node with an attribute
         SpanFocusQuery sfq1 = new SpanFocusQuery(srq, (byte) 1);
-        SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sfq1, aq, true);
+        SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sfq1, aq,
+                true);
 
         kr = ki.search(swaq, (short) 10);
         assertEquals((long) 2, kr.getTotalResults());
@@ -751,12 +747,15 @@
         assertEquals(7, kr.getMatch(1).getEndPos());
 
         // Returning relations whose source has a specific attribute
-        SpanFocusQuery fqr = new SpanFocusQuery(swaq, srq.getTempClassNumbers());
+        SpanFocusQuery fqr = new SpanFocusQuery(swaq,
+                srq.getTempClassNumbers());
         fqr.setMatchTemporaryClass(true);
         fqr.setRemoveTemporaryClasses(true);
-        assertEquals("focus(#[1,2]spanRelationWithAttribute(focus(1: "
-                + "{1: source:{2: target:spanRelation(base:>:child-of)}}), "
-                + "spanAttribute(base:@:case=accusative)))", fqr.toString());
+        assertEquals(
+                "focus(#[1,2]spanRelationWithAttribute(focus(1: "
+                        + "{1: source:{2: target:spanRelation(base:>:child-of)}}), "
+                        + "spanAttribute(base:@:case=accusative)))",
+                fqr.toString());
 
         kr = ki.search(fqr, (short) 10);
         assertEquals((long) 2, kr.getTotalResults());
@@ -799,19 +798,19 @@
     /**
      * Relation whose nodes have a specific attribute. Alternative
      * query (actually used in serialization)
-     * */
+     */
     @Test
     public void testCase10b () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanAttributeQuery aq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:case=accusative")), true);
+        SpanAttributeQuery aq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:case=accusative")), true);
         kr = ki.search(aq, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setSourceClass((byte) 1);
         srq.setTargetClass((byte) 2);
         kr = ki.search(srq, (short) 20);
@@ -868,24 +867,24 @@
 
     /**
      * Matching both relation nodes whose a specific attribute
-     * */
+     */
     @Test
     public void testCase11 () throws IOException {
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanAttributeQuery aq = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:case=accusative")), true);
+        SpanAttributeQuery aq = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:case=accusative")), true);
         kr = ki.search(aq, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
 
-        SpanAttributeQuery aq2 = new SpanAttributeQuery(new SpanTermQuery(
-                new Term("base", "@:case=accusative")), true);
+        SpanAttributeQuery aq2 = new SpanAttributeQuery(
+                new SpanTermQuery(new Term("base", "@:case=accusative")), true);
         kr = ki.search(aq2, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
 
-        SpanRelationQuery srq = new SpanRelationQuery(new SpanTermQuery(
-                new Term("base", ">:child-of")), true);
+        SpanRelationQuery srq = new SpanRelationQuery(
+                new SpanTermQuery(new Term("base", ">:child-of")), true);
         srq.setSourceClass((byte) 1);
         srq.setTargetClass((byte) 2);
         kr = ki.search(srq, (short) 20);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
index fd6b3b3..3cbc34f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
@@ -25,16 +25,16 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("base", "text", "[(0-1)s:c|_1$<i>0<i>1]"
-                + "[(1-2)s:e|_2$<i>1<i>2]"
-                + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
-                + "[(3-4)s:c|s:b|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
-                + "[(4-5)s:e|s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
-                + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8]"
-                + "[(6-7)s:d|_7$<i>6<i>7<b>0]"
-                + "[(7-8)s:e|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
-                + "[(8-9)s:e|s:b|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
-                + "[(9-10)s:d|_10$<i>9<i>10]");
+        fd.addTV("base", "text",
+                "[(0-1)s:c|_1$<i>0<i>1]" + "[(1-2)s:e|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
+                        + "[(3-4)s:c|s:b|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
+                        + "[(4-5)s:e|s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
+                        + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8]"
+                        + "[(6-7)s:d|_7$<i>6<i>7<b>0]"
+                        + "[(7-8)s:e|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
+                        + "[(8-9)s:e|s:b|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
+                        + "[(9-10)s:d|_10$<i>9<i>10]");
         return fd;
     }
 
@@ -77,12 +77,13 @@
         return fd;
     }
 
-    @Test    
+
+    @Test
     public void testTermQuery () throws IOException {
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.commit();
-        
+
         // Quantifier only
         // c{1,2}
         SpanQuery sq = new SpanRepetitionQuery(
@@ -101,9 +102,10 @@
         assertEquals(5, kr.getMatch(4).getStartPos());
         assertEquals(6, kr.getMatch(4).getEndPos());
     }
-    
+
+
     @Test
-    public void testRepetitionInSequences() throws IOException {
+    public void testRepetitionInSequences () throws IOException {
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.commit();
@@ -111,8 +113,9 @@
         SpanQuery sq, sq2;
         // ec{1,2}
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:e")),
-                new SpanRepetitionQuery(new SpanTermQuery(new Term("base",
-                        "s:c")), 1, 2, true));
+                new SpanRepetitionQuery(
+                        new SpanTermQuery(new Term("base", "s:c")), 1, 2,
+                        true));
 
         kr = ki.search(sq, (short) 10);
         // 1-3, 1-4, 4-6
@@ -140,17 +143,18 @@
         assertEquals((long) 5, kr.getTotalResults());
     }
 
+
     @Test
-    public void testMinZeroRepetition() throws IOException {
-    	ki = new KrillIndex();
+    public void testMinZeroRepetition () throws IOException {
+        ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.commit();
-    	
-        SpanQuery sq, sq2;    	
-    	sq = new SpanTermQuery(new Term("base", "s:e"));
-    	kr = ki.search(sq, (short) 10);
-    	
-    	assertEquals((long) 4, kr.getTotalResults());
+
+        SpanQuery sq, sq2;
+        sq = new SpanTermQuery(new Term("base", "s:e"));
+        kr = ki.search(sq, (short) 10);
+
+        assertEquals((long) 4, kr.getTotalResults());
         assertEquals(1, kr.getMatch(0).getStartPos());
         assertEquals(2, kr.getMatch(0).getEndPos());
         assertEquals(4, kr.getMatch(1).getStartPos());
@@ -159,18 +163,17 @@
         assertEquals(8, kr.getMatch(2).getEndPos());
         assertEquals(8, kr.getMatch(3).getStartPos());
         assertEquals(9, kr.getMatch(3).getEndPos());
-
-        sq2 = new SpanNextQuery(sq,
-                new SpanRepetitionQuery(new SpanTermQuery(new Term("base",
-                        "s:c")), 0, 1, true));
-
-        kr = ki.search(sq2, (short) 10);
-        for (Match km : kr.getMatches()){
-	     	//System.out.println(km.getSnippetBrackets());
-	     	System.out.println(km.getStartPos() +","+km.getEndPos());
-	     }
+        try {
+            sq2 = new SpanNextQuery(sq, new SpanRepetitionQuery(
+                    new SpanTermQuery(new Term("base", "s:c")), 0, 1, true));
+        }
+        catch (IllegalArgumentException e) {
+            assertEquals("Minimum repetition must not lower than 1.",
+                    e.getMessage());
+        }
     }
 
+
     /** Skip to */
     @Test
     public void testCase2 () throws IOException {
@@ -191,8 +194,9 @@
 
         // ec{2,2}
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:e")),
-                new SpanRepetitionQuery(new SpanTermQuery(new Term("base",
-                        "s:c")), 2, 2, true));
+                new SpanRepetitionQuery(
+                        new SpanTermQuery(new Term("base", "s:c")), 2, 2,
+                        true));
 
         kr = ki.search(sq, (short) 10);
         assertEquals((long) 2, kr.getTotalResults());
@@ -211,10 +215,11 @@
         SpanQuery sq, sq2;
         // ec{1,2}
         sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:e")),
-                new SpanOrQuery(new SpanRepetitionQuery(new SpanTermQuery(
-                        new Term("base", "s:c")), 1, 1, true),
-                        new SpanRepetitionQuery(new SpanTermQuery(new Term(
-                                "base", "s:b")), 1, 1, true)));
+                new SpanOrQuery(new SpanRepetitionQuery(
+                        new SpanTermQuery(new Term("base", "s:c")), 1, 1, true),
+                        new SpanRepetitionQuery(
+                                new SpanTermQuery(new Term("base", "s:b")), 1,
+                                1, true)));
         kr = ki.search(sq, (short) 10);
         assertEquals((long) 3, kr.getTotalResults());
         assertEquals(1, kr.getMatch(0).startPos);
@@ -235,14 +240,14 @@
 
         SpanQuery sq;
         // c{2,2}
-        sq = new SpanRepetitionQuery(
-                new SpanTermQuery(new Term("base", "s:c")), 1, 3, true);
+        sq = new SpanRepetitionQuery(new SpanTermQuery(new Term("base", "s:c")),
+                1, 3, true);
         kr = ki.search(sq, (short) 10);
         // 2-3, 2-4, 2-5, 3-4, 3-5, 3-6, 4-5, 4-6, 5-6, 7-8  
         assertEquals((long) 10, kr.getTotalResults());
 
-        sq = new SpanRepetitionQuery(
-                new SpanTermQuery(new Term("base", "s:c")), 2, 3, true);
+        sq = new SpanRepetitionQuery(new SpanTermQuery(new Term("base", "s:c")),
+                2, 3, true);
         kr = ki.search(sq, (short) 10);
         // 2-4, 2-5, 3-5, 3-6, 4-6 
         assertEquals((long) 5, kr.getTotalResults());
@@ -266,8 +271,8 @@
 
         SpanQuery sq0, sq1, sq2;
         sq0 = new SpanTermQuery(new Term("tokens", "tt/p:NN"));
-        sq1 = new SpanRepetitionQuery(new SpanTermQuery(new Term("tokens",
-                "tt/p:ADJA")), 2, 3, true);
+        sq1 = new SpanRepetitionQuery(
+                new SpanTermQuery(new Term("tokens", "tt/p:ADJA")), 2, 3, true);
         sq2 = new SpanNextQuery(sq1, sq0);
         kr = ki.search(sq2, (short) 10);
 
@@ -276,10 +281,10 @@
         assertEquals(77, kr.getMatch(0).getEndPos());
         assertEquals(74, kr.getMatch(1).getStartPos());
         assertEquals(77, kr.getMatch(1).getEndPos());
-        
 
-        sq2 = new SpanNextQuery(new SpanTermQuery(new Term("tokens",
-                "s:offenen")), sq2);
+
+        sq2 = new SpanNextQuery(
+                new SpanTermQuery(new Term("tokens", "s:offenen")), sq2);
         kr = ki.search(sq2, (short) 10);
 
         assertEquals((long) 1, kr.getTotalResults());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
index b0c1305..8497dd5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
@@ -103,7 +103,7 @@
     /**
      * Matching a SpanElementQuery and a SpanNextQuery
      * Multiple atomic indices
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         //		log.trace("Testcase4");
@@ -157,8 +157,9 @@
     public void testcase6 () throws IOException {
         ki.addDoc(createFieldDoc4());
         ki.commit();
-        sq = new SpanNextQuery(new SpanSegmentQuery(new SpanTermQuery(new Term(
-                "base", "s:b")), new SpanTermQuery(new Term("base", "s:c"))),
+        sq = new SpanNextQuery(
+                new SpanSegmentQuery(new SpanTermQuery(new Term("base", "s:b")),
+                        new SpanTermQuery(new Term("base", "s:c"))),
                 new SpanTermQuery(new Term("base", "s:d")));
 
         kr = ki.search(sq, (short) 10);
@@ -204,9 +205,9 @@
     private FieldDocument createFieldDoc2 () {
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("base", "bdb", "[(0-1)s:b|i:b|_1$<i>0<i>1]"
-                + "[(1-2)s:d|i:d|s:b|_2$<i>1<i>2]"
-                + "[(2-3)s:b|i:b|s:a|_3$<i>2<i>3]");
+        fd.addTV("base", "bdb",
+                "[(0-1)s:b|i:b|_1$<i>0<i>1]" + "[(1-2)s:d|i:d|s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:b|i:b|s:a|_3$<i>2<i>3]");
         return fd;
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
index 81a5ed6..1bd1dcd 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
@@ -144,9 +144,9 @@
     private FieldDocument createFieldDoc2 () {
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("tokens", "bdb", "[(0-1)s:b|i:b|_1$<i>0<i>1]"
-                + "[(1-2)s:d|i:d|s:b|_2$<i>1<i>2]"
-                + "[(2-3)s:b|i:b|s:a|_3$<i>2<i>3]");
+        fd.addTV("tokens", "bdb",
+                "[(0-1)s:b|i:b|_1$<i>0<i>1]" + "[(1-2)s:d|i:d|s:b|_2$<i>1<i>2]"
+                        + "[(2-3)s:b|i:b|s:a|_3$<i>2<i>3]");
         return fd;
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
index 7af71f0..4562c37 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
@@ -42,7 +42,7 @@
 
     /**
      * Left and right expansions
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
 
@@ -83,7 +83,7 @@
     /**
      * Classnumber
      * Check the expansion offsets
-     * */
+     */
     @Test
     public void testCase2 () {
         byte classNumber = 1;
@@ -141,13 +141,13 @@
 
     /**
      * Right expansion with exclusion
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         byte classNumber = 1;
         SpanTermQuery stq = new SpanTermQuery(new Term("tokens", "tt/p:NN"));
-        SpanTermQuery notQuery = new SpanTermQuery(new Term("tokens",
-                "s:Buchstabe"));
+        SpanTermQuery notQuery = new SpanTermQuery(
+                new Term("tokens", "s:Buchstabe"));
 
         SpanExpansionQuery seq = new SpanExpansionQuery(stq, notQuery, 2, 3, 0,
                 classNumber, true);
@@ -177,16 +177,16 @@
     /**
      * Left expansion with exclusion
      * No expansion
-     * */
+     */
     @Test
     public void testCase4 () throws IOException {
         byte classNumber = 1;
         SpanTermQuery stq = new SpanTermQuery(new Term("tokens", "tt/p:NN"));
-        SpanTermQuery notQuery = new SpanTermQuery(new Term("tokens",
-                "tt/p:ADJA"));
+        SpanTermQuery notQuery = new SpanTermQuery(
+                new Term("tokens", "tt/p:ADJA"));
 
-        SpanExpansionQuery seq = new SpanExpansionQuery(stq, notQuery, 0, 2,
-                -1, classNumber, true);
+        SpanExpansionQuery seq = new SpanExpansionQuery(stq, notQuery, 0, 2, -1,
+                classNumber, true);
         kr = ki.search(seq, (short) 10);
 
         assertEquals(6, kr.getMatch(0).getStartPos());
@@ -221,7 +221,7 @@
      * TODO: end => to be handled in rendering process
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase5 () throws IOException {
         KrillIndex ki = new KrillIndex();
@@ -259,7 +259,7 @@
      * Expansion exclusion : multiple documents
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase6 () throws IOException {
         KrillIndex ki = new KrillIndex();
@@ -289,15 +289,16 @@
 
     /**
      * Skip to
-     * */
+     */
     @Test
     public void testCase7 () throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
         ki.addDoc(getClass().getResourceAsStream("/wiki/00002.json.gz"), true);
         ki.commit();
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/poly3.json")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/poly3.json").getFile(),
+                "UTF-8");
         String jsonQuery = readFile(jsonPath);
         SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(jsonQuery);
 
@@ -322,7 +323,7 @@
      * Warning: This is not armoured by <base/s=t>!
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testQueryRewriteBug () throws IOException {
         KrillIndex ki = new KrillIndex();
@@ -398,20 +399,20 @@
      * Query rewrite bug
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testExpansionQueryBug3 () throws IOException, QueryException {
         KrillIndex ki = new KrillIndex();
         ki.addDoc(createFieldDoc3());
         ki.addDoc(createFieldDoc4());
         ki.commit();
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/bugs/expansion_bug_3.jsonld")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(getClass()
+                .getResource("/queries/bugs/expansion_bug_3.jsonld").getFile(),
+                "UTF-8");
         String json = readFile(jsonPath);
         KrillQuery kq = new KrillQuery("base");
         SpanQuery sq = kq.fromKoral(json).toQuery();
-        assertEquals(
-                sq.toString(),
+        assertEquals(sq.toString(),
                 "focus(254: spanContain(<base:base/s:t />, {254: spanExpansion(base:s:c, []{0, 4}, right)}))");
 
         kr = ki.search(sq, (short) 10);
@@ -442,7 +443,8 @@
                         + "[(3-4)s:c|s:d|_3$<i>3<i>4]"
                         + "[(4-5)s:e|_4$<i>4<i>5]" + "[(5-6)s:c|_5$<i>5<i>6]"
                         + "[(6-7)s:d|_6$<i>6<i>7]" + "[(7-8)s:e|_7$<i>7<i>8]"
-                        + "[(8-9)s:e|_8$<i>8<i>9]" + "[(9-10)s:c|_9$<i>9<i>10]");
+                        + "[(8-9)s:e|_8$<i>8<i>9]"
+                        + "[(9-10)s:c|_9$<i>9<i>10]");
         return fd;
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
index 206628b..e0349db 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
@@ -37,10 +37,10 @@
 
     @Test
     public void testCase1 () throws IOException {
-        SpanDistanceQuery sdq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("tokens", "tt/p:NN")), new SpanTermQuery(new Term(
-                "tokens", "tt/p:VAFIN")), new DistanceConstraint(5, 5, true,
-                false), true);
+        SpanDistanceQuery sdq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("tokens", "tt/p:NN")),
+                new SpanTermQuery(new Term("tokens", "tt/p:VAFIN")),
+                new DistanceConstraint(5, 5, true, false), true);
 
         SpanSubspanQuery ssq = new SpanSubspanQuery(sdq, 0, 2, true);
         kr = ki.search(ssq, (short) 10);
@@ -69,10 +69,10 @@
 
     @Test
     public void testCase2 () {
-        SpanDistanceQuery sdq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("tokens", "tt/p:NN")), new SpanTermQuery(new Term(
-                "tokens", "tt/p:VAFIN")), new DistanceConstraint(5, 5, true,
-                false), true);
+        SpanDistanceQuery sdq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("tokens", "tt/p:NN")),
+                new SpanTermQuery(new Term("tokens", "tt/p:VAFIN")),
+                new DistanceConstraint(5, 5, true, false), true);
 
         // the subspan length is longer than the span length
         SpanSubspanQuery ssq = new SpanSubspanQuery(sdq, 0, 7, true);
@@ -99,10 +99,10 @@
     // Length 0
     @Test
     public void testCase3 () {
-        SpanDistanceQuery sdq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("tokens", "tt/p:NN")), new SpanTermQuery(new Term(
-                "tokens", "tt/p:VAFIN")), new DistanceConstraint(5, 5, true,
-                false), true);
+        SpanDistanceQuery sdq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("tokens", "tt/p:NN")),
+                new SpanTermQuery(new Term("tokens", "tt/p:VAFIN")),
+                new DistanceConstraint(5, 5, true, false), true);
 
         SpanSubspanQuery ssq = new SpanSubspanQuery(sdq, 3, 0, true);
         kr = ki.search(ssq, (short) 10);
@@ -141,8 +141,8 @@
                         + "[(3-4)s:c|i:c|_2$<i>4<i>6]");
         ki.addDoc(fd);
         ki.commit();
-        SpanSubspanQuery ssq = new SpanSubspanQuery(new SpanElementQuery(
-                "base", "x"), -1, 1, true);
+        SpanSubspanQuery ssq = new SpanSubspanQuery(
+                new SpanElementQuery("base", "x"), -1, 1, true);
         kr = ki.search(ssq, (short) 10);
 
         /*        
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestUnorderedDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestUnorderedDistanceIndex.java
index b94dc60..e461522 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestUnorderedDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestUnorderedDistanceIndex.java
@@ -28,16 +28,16 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("base", "text", "[(0-1)s:c|_1$<i>0<i>1]"
-                + "[(1-2)s:e|_2$<i>1<i>2]"
-                + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
-                + "[(3-4)s:c|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
-                + "[(4-5)s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
-                + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8<b>0]"
-                + "[(6-7)s:d|_7$<i>6<i>7]"
-                + "[(7-8)s:f|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
-                + "[(8-9)s:e|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
-                + "[(9-10)s:d|_10$<i>9<i>10]");
+        fd.addTV("base", "text",
+                "[(0-1)s:c|_1$<i>0<i>1]" + "[(1-2)s:e|_2$<i>1<i>2]"
+                        + "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
+                        + "[(3-4)s:c|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
+                        + "[(4-5)s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
+                        + "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8<b>0]"
+                        + "[(6-7)s:d|_7$<i>6<i>7]"
+                        + "[(7-8)s:f|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
+                        + "[(8-9)s:e|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
+                        + "[(9-10)s:d|_10$<i>9<i>10]");
         return fd;
     }
 
@@ -45,12 +45,13 @@
     private FieldDocument createFieldDoc1 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
-        fd.addTV("base", "text", "[(0-1)s:d|_1$<i>0<i>1]"
-                + "[(1-2)s:c|_2$<i>1<i>2]" + "[(2-3)s:e|_3$<i>2<i>3]"
-                + "[(3-4)s:e|_4$<i>3<i>4]" + "[(4-5)s:d|_5$<i>4<i>5]"
-                + "[(5-6)s:e|_6$<i>5<i>6]" + "[(6-7)s:e|_7$<i>6<i>7]"
-                + "[(7-8)s:c|_8$<i>7<i>8]" + "[(8-9)s:e|_9$<i>8<i>9]"
-                + "[(9-10)s:d|_10$<i>9<i>10]");
+        fd.addTV("base", "text",
+                "[(0-1)s:d|_1$<i>0<i>1]" + "[(1-2)s:c|_2$<i>1<i>2]"
+                        + "[(2-3)s:e|_3$<i>2<i>3]" + "[(3-4)s:e|_4$<i>3<i>4]"
+                        + "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:e|_6$<i>5<i>6]"
+                        + "[(6-7)s:e|_7$<i>6<i>7]" + "[(7-8)s:c|_8$<i>7<i>8]"
+                        + "[(8-9)s:e|_9$<i>8<i>9]"
+                        + "[(9-10)s:d|_10$<i>9<i>10]");
         return fd;
     }
 
@@ -58,18 +59,20 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("base", "text", "[(0-1)s:f|_1$<i>0<i>1]"
-                + "[(1-2)s:c|_2$<i>1<i>2]" + "[(2-3)s:e|_3$<i>2<i>3]"
-                + "[(3-4)s:e|_4$<i>3<i>4]" + "[(4-5)s:d|_5$<i>4<i>5]"
-                + "[(5-6)s:f|_6$<i>5<i>6]" + "[(6-7)s:f|_7$<i>6<i>7]");
+        fd.addTV("base", "text",
+                "[(0-1)s:f|_1$<i>0<i>1]" + "[(1-2)s:c|_2$<i>1<i>2]"
+                        + "[(2-3)s:e|_3$<i>2<i>3]" + "[(3-4)s:e|_4$<i>3<i>4]"
+                        + "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:f|_6$<i>5<i>6]"
+                        + "[(6-7)s:f|_7$<i>6<i>7]");
         return fd;
     }
 
 
     private SpanQuery createQuery (String x, String y, int min, int max,
             boolean isOrdered) {
-        SpanQuery sq = new SpanDistanceQuery(new SpanTermQuery(new Term("base",
-                x)), new SpanTermQuery(new Term("base", y)),
+        SpanQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("base", x)),
+                new SpanTermQuery(new Term("base", y)),
                 new DistanceConstraint(min, max, isOrdered, false), true);
         return sq;
     }
@@ -78,8 +81,8 @@
     private SpanQuery createElementQuery (String x, String y, int min, int max,
             boolean isOrdered) {
         SpanQuery sq = new SpanDistanceQuery(new SpanElementQuery("base", x),
-                new SpanElementQuery("base", y), new DistanceConstraint(min,
-                        max, isOrdered, false), true);
+                new SpanElementQuery("base", y),
+                new DistanceConstraint(min, max, isOrdered, false), true);
         return sq;
     }
 
@@ -89,7 +92,7 @@
      * The first first and second spans are too far from each other
      * One of the spans ends first
      * One of the candidate list is empty
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         //System.out.println("testcase 1");
@@ -113,7 +116,7 @@
      * the doc
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         //System.out.println("testcase 2");
@@ -134,7 +137,7 @@
      * Ensure same Doc
      * 
      * @throws IOException
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         //System.out.println("testcase 3");
@@ -167,9 +170,8 @@
         ki.addDoc(createFieldDoc2());
         ki.commit();
 
-        SpanQuery sq = new SpanNextQuery(
-                createQuery("s:d", "s:e", 1, 2, false), new SpanTermQuery(
-                        new Term("base", "s:f")));
+        SpanQuery sq = new SpanNextQuery(createQuery("s:d", "s:e", 1, 2, false),
+                new SpanTermQuery(new Term("base", "s:f")));
 
         kr = ki.search(sq, (short) 10);
         assertEquals(kr.getTotalResults(), 2);
@@ -235,7 +237,7 @@
      * span query yields "redundant results" because matches are
      * searched for each
      * child span.
-     * */
+     */
     @Test
     public void testCase6 () throws IOException {
         ki = new KrillIndex();
@@ -252,7 +254,7 @@
 
     /**
      * Nested distance queries
-     * */
+     */
     @Test
     public void testCase7 () throws IOException {
         //System.out.println("testcase 7");
@@ -262,9 +264,9 @@
         ki.commit();
 
         SpanQuery sq = createQuery("s:c", "s:d", 1, 2, false);
-        SpanQuery sq2 = new SpanDistanceQuery(sq, new SpanTermQuery(new Term(
-                "base", "s:e")), new DistanceConstraint(1, 2, true, false),
-                true);
+        SpanQuery sq2 = new SpanDistanceQuery(sq,
+                new SpanTermQuery(new Term("base", "s:e")),
+                new DistanceConstraint(1, 2, true, false), true);
         kr = ki.search(sq2, (short) 10);
         assertEquals(kr.getTotalResults(), 3);
         assertEquals(5, kr.getMatch(0).getStartPos());
@@ -279,14 +281,15 @@
 
     /**
      * Multiple NextSpans in the same first span position
-     * */
+     */
     @Test
     public void testCase8 () throws IOException {
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc1());
         ki.commit();
-        SpanQuery sq = new SpanNextQuery(new SpanTermQuery(new Term("base",
-                "s:d")), createQuery("s:c", "s:e", 1, 2, false));
+        SpanQuery sq = new SpanNextQuery(
+                new SpanTermQuery(new Term("base", "s:d")),
+                createQuery("s:c", "s:e", 1, 2, false));
         kr = ki.search(sq, (short) 10);
 
         assertEquals(kr.getTotalResults(), 3);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestUnorderedElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestUnorderedElementDistanceIndex.java
index d3d1c4d..be79a11 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestUnorderedElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestUnorderedElementDistanceIndex.java
@@ -97,13 +97,14 @@
         SpanElementQuery e = new SpanElementQuery("base", elementType);
         return new SpanDistanceQuery(new SpanTermQuery(new Term("base", x)),
                 new SpanTermQuery(new Term("base", y)), new DistanceConstraint(
-                        e, minDistance, maxDistance, isOrdered, false), true);
+                        e, minDistance, maxDistance, isOrdered, false),
+                true);
     }
 
 
     /**
      * Only terms within an element are matched.
-     * */
+     */
     @Test
     public void testCase1 () throws IOException {
         //System.out.println("testCase1");
@@ -135,7 +136,7 @@
      * In the beginning, first and second spans are already too far
      * from each other
      * (one-list-empty case, both-list-empty-case).
-     * */
+     */
     @Test
     public void testCase2 () throws IOException {
         //System.out.println("testCase2");
@@ -162,7 +163,7 @@
 
     /**
      * Multiple occurrences in an element.
-     * */
+     */
     @Test
     public void testCase3 () throws IOException {
         //System.out.println("testCase3");
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWPDIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWPDIndex.java
index a9fd222..55c5f78 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWPDIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWPDIndex.java
@@ -37,8 +37,8 @@
     private SpanDistanceQuery createElementDistanceQuery (String e, String x,
             String y, int min, int max, boolean isOrdered, boolean exclusion) {
         SpanElementQuery eq = new SpanElementQuery("tokens", e);
-        SpanDistanceQuery sq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("tokens", x)),
+        SpanDistanceQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("tokens", x)),
                 new SpanTermQuery(new Term("tokens", y)),
                 new DistanceConstraint(eq, min, max, isOrdered, exclusion),
                 true);
@@ -48,8 +48,8 @@
 
     private SpanDistanceQuery createDistanceQuery (String x, String y, int min,
             int max, boolean isOrdered, boolean exclusion) {
-        SpanDistanceQuery sq = new SpanDistanceQuery(new SpanTermQuery(
-                new Term("tokens", x)),
+        SpanDistanceQuery sq = new SpanDistanceQuery(
+                new SpanTermQuery(new Term("tokens", x)),
                 new SpanTermQuery(new Term("tokens", y)),
                 new DistanceConstraint(min, max, isOrdered, exclusion), true);
         return sq;
@@ -192,21 +192,24 @@
     @Test
     public void testCase5 () throws IOException {
         SpanQuery sq;
-        sq = new SpanRepetitionQuery(new SpanTermQuery(new Term("tokens",
-                "mate/p:ADJA")), 1, 2, true);
+        sq = new SpanRepetitionQuery(
+                new SpanTermQuery(new Term("tokens", "mate/p:ADJA")), 1, 2,
+                true);
         ks = new Krill(sq);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 4116416);
         //0.9s
 
-        sq = new SpanRepetitionQuery(new SpanTermQuery(new Term("tokens",
-                "mate/p:ADJA")), 1, 1, true);
+        sq = new SpanRepetitionQuery(
+                new SpanTermQuery(new Term("tokens", "mate/p:ADJA")), 1, 1,
+                true);
         ks = new Krill(sq);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 3879671);
 
-        sq = new SpanRepetitionQuery(new SpanTermQuery(new Term("tokens",
-                "mate/p:ADJA")), 2, 2, true);
+        sq = new SpanRepetitionQuery(
+                new SpanTermQuery(new Term("tokens", "mate/p:ADJA")), 2, 2,
+                true);
         ks = new Krill(sq);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 236745);
@@ -217,16 +220,18 @@
     /** Next and repetition */
     @Test
     public void testCase6 () throws IOException {
-        SpanQuery sq = new SpanNextQuery(new SpanTermQuery(new Term("tokens",
-                "tt/p:NN")), new SpanRepetitionQuery(new SpanTermQuery(
-                new Term("tokens", "mate/p:ADJA")), 2, 2, true));
+        SpanQuery sq = new SpanNextQuery(
+                new SpanTermQuery(new Term("tokens", "tt/p:NN")),
+                new SpanRepetitionQuery(
+                        new SpanTermQuery(new Term("tokens", "mate/p:ADJA")), 2,
+                        2, true));
         ks = new Krill(sq);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 30223);
         // 1.1s
 
-        SpanQuery sq2 = new SpanNextQuery(sq, new SpanTermQuery(new Term(
-                "tokens", "tt/p:NN")));
+        SpanQuery sq2 = new SpanNextQuery(sq,
+                new SpanTermQuery(new Term("tokens", "tt/p:NN")));
         ks = new Krill(sq2);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 26607);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index 7960560..ee35980 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -289,10 +289,11 @@
         ki.addDoc(fd);
 
         fd = new FieldDocument();
-        fd.addTV("base", "x   y   z   h   ", "[(0-3)s:x]" +  // 1
-                "[(3-6)s:y]" +  // 2
-                "[(6-9)s:z]" +  // 3
-                "[(9-12)s:h]"); // 4
+        fd.addTV("base", "x   y   z   h   ",
+                "[(0-3)s:x]" +  // 1
+                        "[(3-6)s:y]" +  // 2
+                        "[(6-9)s:z]" +  // 3
+                        "[(9-12)s:h]"); // 4
         ki.addDoc(fd);
 
         // <a>x<a>y<a>zabc</a>abc</a>abc</a>
@@ -621,26 +622,16 @@
         fd.addTV("base", "h  h  i  j  h  i  j  h  i  j  h  h  ",
                 "[(0-3)s:h|<>:a$<b>64<i>0<i>15<i>4<b>0|"
                         + "<>:a$<b>64<i>0<i>18<i>6<b>0|"
-                        + "<>:a$<b>64<i>0<i>27<i>8<b>0|_0$<i>0<i>3]"
-                        + // 1
-                        "[(3-6)s:h|_1$<i>3<i>6]"
-                        + // 2
-                        "[(6-9)s:i|_2$<i>6<i>9]"
-                        + // 3
-                        "[(9-12)s:j|_3$<i>9<i>12]"
-                        + // 4
-                        "[(12-15)s:h|_4$<i>12<i>15]"
-                        + // 5
-                        "[(15-18)s:i|_5$<i>15<i>18]"
-                        + // 6
-                        "[(18-21)s:j|_6$<i>18<i>21]"
-                        + // 7
-                        "[(21-24)s:h|_7$<i>21<i>24]"
-                        + // 8
-                        "[(24-27)s:i|_8$<i>24<i>27]"
-                        + // 9
-                        "[(27-30)s:j|_9$<i>27<i>30]"
-                        + // 10
+                        + "<>:a$<b>64<i>0<i>27<i>8<b>0|_0$<i>0<i>3]" + // 1
+                        "[(3-6)s:h|_1$<i>3<i>6]" + // 2
+                        "[(6-9)s:i|_2$<i>6<i>9]" + // 3
+                        "[(9-12)s:j|_3$<i>9<i>12]" + // 4
+                        "[(12-15)s:h|_4$<i>12<i>15]" + // 5
+                        "[(15-18)s:i|_5$<i>15<i>18]" + // 6
+                        "[(18-21)s:j|_6$<i>18<i>21]" + // 7
+                        "[(21-24)s:h|_7$<i>21<i>24]" + // 8
+                        "[(24-27)s:i|_8$<i>24<i>27]" + // 9
+                        "[(27-30)s:j|_9$<i>27<i>30]" + // 10
                         "[(30-33)s:h|_10$<i>30<i>33|<>:a$<b>64<i>30<i>36<i>12<b>0]"
                         + // 11
                         "[(33-36)s:h|_11$<i>33<i>36|<>:a$<b>64<i>33<i>36<i>12<b>0]"); // 12
@@ -733,8 +724,8 @@
 
         // xyz
         fd = new FieldDocument();
-        fd.addTV("base", "x   y   z   ", "[(0-3)s:x]" + "[(3-6)s:y]"
-                + "[(6-9)s:z]");
+        fd.addTV("base", "x   y   z   ",
+                "[(0-3)s:x]" + "[(3-6)s:y]" + "[(6-9)s:z]");
         ki.addDoc(fd);
 
         // <a>x<a><b>y<a>zcde</a>cde</b></a>cde</a>
@@ -751,19 +742,19 @@
 
         // <a><a><a>h</a>hhij</a>hij</a>hij</a>
         fd = new FieldDocument();
-        fd.addTV("base", "h   i   j   h   i   j   h   i   j   ", "[(0-3)s:h|"
-                + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
-                + "<>:a$<b>64<i>0<i>27<i>6<b>0|"
-                + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
-                + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
-                + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
-                + "[(30-33)s:i]" + "[(33-36)s:j]");
+        fd.addTV("base", "h   i   j   h   i   j   h   i   j   ",
+                "[(0-3)s:h|" + "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+                        + "<>:a$<b>64<i>0<i>27<i>6<b>0|"
+                        + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
+                        + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
+                        + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
+                        + "[(30-33)s:i]" + "[(33-36)s:j]");
         ki.addDoc(fd);
 
         // xyz
         fd = new FieldDocument();
-        fd.addTV("base", "a  b  c  ", "[(0-3)s:a]" + "[(3-6)s:b]"
-                + "[(6-9)s:c]");
+        fd.addTV("base", "a  b  c  ",
+                "[(0-3)s:a]" + "[(3-6)s:b]" + "[(6-9)s:c]");
         ki.addDoc(fd);
 
         // Save documents
@@ -812,11 +803,8 @@
         // Er schrie: <s>"Das war ich!"</s>
         FieldDocument fd = new FieldDocument();
         fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "Er schrie: \"Das war ich!\" und ging.",
-                "[(0-2)s:Er|_0$<i>0<i>3]"
-                        + "[(3-9)s:schrie|_1$<i>3<i>9]"
+        fd.addTV("base", "Er schrie: \"Das war ich!\" und ging.",
+                "[(0-2)s:Er|_0$<i>0<i>3]" + "[(3-9)s:schrie|_1$<i>3<i>9]"
                         + "[(12-15)s:Das|_2$<i>12<i>15|<>:sentence$<b>64<i>11<i>25<i>5<b>0]"
                         + "[(16-19)s:war|_3$<i>16<i>19]"
                         + "[(20-23)s:ich|_4$<i>20<i>23]"
@@ -827,70 +815,85 @@
         // Save documents
         ki.commit();
 
-        SpanQuery sq = new SpanClassQuery(new SpanElementQuery("base",
-                "sentence"), (byte) 3);
+        SpanQuery sq = new SpanClassQuery(
+                new SpanElementQuery("base", "sentence"), (byte) 3);
         Result kr;
         kr = ki.search(sq, 0, (short) 15, true, (short) 1, true, (short) 1);
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
-        assertEquals("... schrie: [[\"{3:Das war ich}!\"]] und ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("... schrie: [[\"{3:Das war ich}!\"]] und ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals(
                 "<span class=\"context-left\"><span class=\"more\"></span>schrie: </span><span class=\"match\"><mark>&quot;<mark class=\"class-3 level-0\">Das war ich</mark>!&quot;</mark></span><span class=\"context-right\"> und<span class=\"more\"></span></span>",
                 kr.getMatch(0).getSnippetHTML());
 
         kr = ki.search(sq, 0, (short) 15, true, (short) 0, true, (short) 0);
-        assertEquals("... [[\"{3:Das war ich}!\"]] ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals("... [[\"{3:Das war ich}!\"]] ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
         kr = ki.search(sq, 0, (short) 15, true, (short) 6, true, (short) 6);
-        assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging.", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging.",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
         kr = ki.search(sq, 0, (short) 15, true, (short) 2, true, (short) 2);
-        assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
-        sq = new SpanClassQuery(new SpanWithinQuery(new SpanElementQuery(
-                "base", "sentence"), new SpanClassQuery(new SpanTermQuery(
-                new Term("base", "s:Das")), (byte) 2)), (byte) 1);
+        sq = new SpanClassQuery(
+                new SpanWithinQuery(new SpanElementQuery("base", "sentence"),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:Das")),
+                                (byte) 2)),
+                (byte) 1);
 
         kr = ki.search(sq, (short) 15);
-        assertEquals("Er schrie: [[\"{1:{2:Das} war ich}!\"]] und ging.", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("Er schrie: [[\"{1:{2:Das} war ich}!\"]] und ging.",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
-        sq = new SpanClassQuery(new SpanWithinQuery(new SpanElementQuery(
-                "base", "sentence"), new SpanClassQuery(new SpanTermQuery(
-                new Term("base", "s:war")), (byte) 2)), (byte) 1);
+        sq = new SpanClassQuery(
+                new SpanWithinQuery(new SpanElementQuery("base", "sentence"),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:war")),
+                                (byte) 2)),
+                (byte) 1);
 
         kr = ki.search(sq, (short) 15);
-        assertEquals("Er schrie: [[\"{1:Das {2:war} ich}!\"]] und ging.", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("Er schrie: [[\"{1:Das {2:war} ich}!\"]] und ging.",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
-        sq = new SpanClassQuery(new SpanWithinQuery(new SpanElementQuery(
-                "base", "sentence"), new SpanClassQuery(new SpanTermQuery(
-                new Term("base", "s:ich")), (byte) 2)), (byte) 1);
+        sq = new SpanClassQuery(
+                new SpanWithinQuery(new SpanElementQuery("base", "sentence"),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:ich")),
+                                (byte) 2)),
+                (byte) 1);
 
         kr = ki.search(sq, (short) 15);
-        assertEquals("Er schrie: [[\"{1:Das war {2:ich}}!\"]] und ging.", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("Er schrie: [[\"{1:Das war {2:ich}}!\"]] und ging.",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("totalResults", kr.getTotalResults(), 1);
 
-        sq = new SpanClassQuery(new SpanWithinQuery(new SpanElementQuery(
-                "base", "sentence"), new SpanClassQuery(new SpanTermQuery(
-                new Term("base", "s:und")), (byte) 2)), (byte) 1);
+        sq = new SpanClassQuery(
+                new SpanWithinQuery(new SpanElementQuery("base", "sentence"),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:und")),
+                                (byte) 2)),
+                (byte) 1);
 
         kr = ki.search(sq, (short) 15);
         assertEquals("totalResults", kr.getTotalResults(), 0);
 
-        sq = new SpanClassQuery(new SpanWithinQuery(new SpanElementQuery(
-                "base", "sentence"), new SpanClassQuery(new SpanTermQuery(
-                new Term("base", "s:schrie")), (byte) 2)), (byte) 1);
+        sq = new SpanClassQuery(
+                new SpanWithinQuery(new SpanElementQuery("base", "sentence"),
+                        new SpanClassQuery(
+                                new SpanTermQuery(new Term("base", "s:schrie")),
+                                (byte) 2)),
+                (byte) 1);
 
         kr = ki.search(sq, (short) 15);
         assertEquals("totalResults", kr.getTotalResults(), 0);
@@ -904,12 +907,13 @@
         // Case 1, 6, 7, 13
         // xy<a><a>x</a>b<a>c</a></a>x
         FieldDocument fd = new FieldDocument();
-        fd.addTV("base", "x  y  x  b  c  x  ", "[(0-3)s:x|_0$<i>0<i>3]"
-                + "[(3-6)s:y|_1$<i>3<i>6]"
-                + "[(6-9)s:x|_2$<i>6<i>9|<>:a$<b>64<i>6<i>9<i>3<b>0|"
-                + "<>:a$<b>64<i>6<i>15<i>5<b>0]" + "[(9-12)s:b|_3$<i>9<i>12]"
-                + "[(12-15)s:c|_4$<i>12<i>15|<>:a$<b>64<i>12<i>15<i>5<b>0]"
-                + "[(15-18)s:x|_5$<i>15<i>18]");
+        fd.addTV("base", "x  y  x  b  c  x  ",
+                "[(0-3)s:x|_0$<i>0<i>3]" + "[(3-6)s:y|_1$<i>3<i>6]"
+                        + "[(6-9)s:x|_2$<i>6<i>9|<>:a$<b>64<i>6<i>9<i>3<b>0|"
+                        + "<>:a$<b>64<i>6<i>15<i>5<b>0]"
+                        + "[(9-12)s:b|_3$<i>9<i>12]"
+                        + "[(12-15)s:c|_4$<i>12<i>15|<>:a$<b>64<i>12<i>15<i>5<b>0]"
+                        + "[(15-18)s:x|_5$<i>15<i>18]");
         ki.addDoc(fd);
 
         // Save documents
@@ -925,10 +929,10 @@
 
         assertEquals("totalResults", kr.getTotalResults(), 2);
 
-        assertEquals("x  y  [[x  ]]b  c  x  ", kr.getMatch(0)
-                .getSnippetBrackets());
-        assertEquals("x  y  [[x  b  c  ]]x  ", kr.getMatch(1)
-                .getSnippetBrackets());
+        assertEquals("x  y  [[x  ]]b  c  x  ",
+                kr.getMatch(0).getSnippetBrackets());
+        assertEquals("x  y  [[x  b  c  ]]x  ",
+                kr.getMatch(1).getSnippetBrackets());
 
         assertEquals("StartPos (0)", 2, kr.getMatch(0).startPos);
         assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
@@ -944,9 +948,7 @@
 
         // hij<a>hi<a>h<a>ij</a></a>hi</a>
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "hijhihijhi",
+        fd.addTV("base", "hijhihijhi",
                 "[(0-1)s:h|i:h|_0$<i>0<i>1|-:a$<i>3|-:t$<i>10]"
                         + "[(1-2)s:i|i:i|_1$<i>1<i>2]"
                         + "[(2-3)s:j|i:j|_2$<i>2<i>3]"
@@ -989,9 +991,7 @@
         // 2,5,8,12,13
         // h<a><a>i</a>j</a><a>h</a>i j<a>h i</a>j
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "hijhi jh ij",
+        fd.addTV("base", "hijhi jh ij",
                 "[(0-1)s:h|i:h|_0$<i>0<i>1|-:a$<i>4|-:t$<i>9]"
                         + "[(1-2)s:i|i:i|_1$<i>1<i>2|<>:a$<b>64<i>1<i>2<i>2<b>0|"
                         + "<>:a$<b>64<i>1<i>3<i>3<b>0]"
@@ -1011,9 +1011,9 @@
 
         SpanQuery sq = new SpanWithinQuery(new SpanElementQuery("base", "a"),
                 new SpanNextQuery(new SpanTermQuery(new Term("base", "s:h")),
-                        new SpanNextQuery(new SpanTermQuery(new Term("base",
-                                "s:i")), new SpanTermQuery(new Term("base",
-                                "s:j")))));
+                        new SpanNextQuery(
+                                new SpanTermQuery(new Term("base", "s:i")),
+                                new SpanTermQuery(new Term("base", "s:j")))));
 
         Result kr = ki.search(sq, (short) 10);
         assertEquals("totalResults", kr.getTotalResults(), 0);
@@ -1026,9 +1026,7 @@
         // 4,5,11,13
         // x<a>x h</a>i j h<a>i j</a>
         FieldDocument fd = new FieldDocument();
-        fd.addTV(
-                "base",
-                "xx hi j hi j",
+        fd.addTV("base", "xx hi j hi j",
                 "[(0-1)s:x|i:x|_0$<i>0<i>1|-:a$<i>2|-:t$<i>8]"
                         + "[(1-2)s:x|i:x|_1$<i>1<i>2|<>:a$<b>64<i>1<i>4<i>3<b>0]"
                         + "[(3-4)s:h|i:h|_2$<i>3<i>4]"
@@ -1046,9 +1044,9 @@
 
         SpanQuery sq = new SpanWithinQuery(new SpanElementQuery("base", "a"),
                 new SpanNextQuery(new SpanTermQuery(new Term("base", "s:h")),
-                        new SpanNextQuery(new SpanTermQuery(new Term("base",
-                                "s:i")), new SpanTermQuery(new Term("base",
-                                "s:j")))));
+                        new SpanNextQuery(
+                                new SpanTermQuery(new Term("base", "s:i")),
+                                new SpanTermQuery(new Term("base", "s:j")))));
 
         Result kr = ki.search(sq, (short) 10);
 
@@ -1062,9 +1060,7 @@
         KrillIndex ki = new KrillIndex();
         FieldDocument fd = new FieldDocument();
         // <a>xx <e>hi j <e>hi j</e></e></a>
-        fd.addTV(
-                "base",
-                "xx hi j hi j",
+        fd.addTV("base", "xx hi j hi j",
                 "[(0-1)s:x|i:x|_0$<i>0<i>1|<>:a$<b>64<i>0<i>12<i>8<b>0]"
                         + "[(1-2)s:x|i:x|_1$<i>1<i>2]"
                         + "[(3-4)s:h|i:h|_2$<i>3<i>4|<>:e$<b>64<i>3<i>12<i>8<b>0]"
@@ -1086,11 +1082,11 @@
         sqw = qb.seg("i:x");
         kr = ki.search(sqw.toQuery(), (short) 10);
         assertEquals(2, kr.getTotalResults());
-
+        
         sqw = qb.tag("a");
         kr = ki.search(sqw.toQuery(), (short) 10);
         assertEquals(1, kr.getTotalResults());
-
+        
         sqw = qb.startswith(qb.tag("a"), qb.seg("i:x"));
         assertEquals("spanStartsWith(<base:a />, base:i:x)",
                      sqw.toQuery().toString());
@@ -1098,8 +1094,8 @@
         assertEquals(1, kr.getTotalResults());
         */
         sqw = qb.startswith(qb.tag("e"), qb.seg("i:h"));
-        assertEquals("spanStartsWith(<base:e />, base:i:h)", sqw.toQuery()
-                .toString());
+        assertEquals("spanStartsWith(<base:e />, base:i:h)",
+                sqw.toQuery().toString());
         kr = ki.search(sqw.toQuery(), (short) 10);
         assertEquals(2, kr.getTotalResults());
     };
@@ -1108,8 +1104,9 @@
     // contains(<s>, (es wird | wird es))
     @Test
     public void queryJSONpoly2 () throws QueryException, IOException {
-        String jsonPath = URLDecoder.decode(getClass().getResource("/queries/poly2.json")
-                .getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(
+                getClass().getResource("/queries/poly2.json").getFile(),
+                "UTF-8");
         String jsonPQuery = readFile(jsonPath);
         SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(jsonPQuery);
 
@@ -1135,8 +1132,8 @@
 
 
     @Test
-    public void queryJSONcomplexSpanOrTerm () throws QueryException,
-            IOException {
+    public void queryJSONcomplexSpanOrTerm ()
+            throws QueryException, IOException {
         /*
           at org.apache.lucene.search.spans.SpanOrQuery$1.doc(SpanOrQuery.java:234)
           at de.ids_mannheim.korap.query.spans.WithinSpans.toSameDoc(WithinSpans.java:423)
@@ -1145,15 +1142,18 @@
           at de.ids_mannheim.korap.Krill.apply(Krill.java:304)
         */
 
-        String jsonPath = URLDecoder.decode(getClass().getResource(
-                "/queries/bugs/span_or_bug.jsonld").getFile(),"UTF-8");
+        String jsonPath = URLDecoder.decode(getClass()
+                .getResource("/queries/bugs/span_or_bug.jsonld").getFile(),
+                "UTF-8");
         String jsonPQuery = readFile(jsonPath);
         SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(jsonPQuery);
 
         SpanWithinQuery sq = (SpanWithinQuery) sqwi.toQuery();
 
-        assertEquals("spanStartsWith(<tokens:base/s:s />, "
-                + "spanOr([tokens:s:Er, tokens:s:Sie]))", sq.toString());
+        assertEquals(
+                "spanStartsWith(<tokens:base/s:s />, "
+                        + "spanOr([tokens:s:Er, tokens:s:Sie]))",
+                sq.toString());
 
         KrillIndex ki = new KrillIndex();
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
index 7111b38..101290d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
@@ -139,10 +139,9 @@
     @Test
     public void KorapClassQuery () throws QueryException {
         QueryBuilder kq = new QueryBuilder("field");
-        SpanQuery sq = kq
-                .seq(kq.seg("tree"),
-                        kq._(1, kq.contains(kq.tag("s"), kq.tag("np"))),
-                        kq.re("hey.*")).toQuery();
+        SpanQuery sq = kq.seq(kq.seg("tree"),
+                kq._(1, kq.contains(kq.tag("s"), kq.tag("np"))), kq.re("hey.*"))
+                .toQuery();
         assertEquals(
                 "spanNext(spanNext(field:tree, {1: spanContain(<field:s />, <field:np />)}), SpanMultiTermQueryWrapper(field:/hey.*/))",
                 sq.toString());
@@ -196,11 +195,8 @@
     @Test
     public void KorapShrinkQuery3 () throws QueryException {
         QueryBuilder kq = new QueryBuilder("field");
-        SpanQuery sq = kq
-                .focus(1,
-                        kq._(1,
-                                kq.seq(kq.tag("np"),
-                                        kq._(kq.seg("test").without("no")))))
+        SpanQuery sq = kq.focus(1, kq._(1,
+                kq.seq(kq.tag("np"), kq._(kq.seg("test").without("no")))))
                 .toQuery();
         assertEquals(
                 "focus(1: {1: spanNext(<field:np />, {1: spanNot(field:test, field:no, 0, 0)})})",
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index d66be4f..af53472 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -22,13 +22,12 @@
 
     @Test
     public void queryJSONBsp1 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1.jsonld").getFile());
 
         // There is a repetition in here
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
         assertTrue(sqwi.isOptional());
     };
@@ -36,13 +35,12 @@
 
     @Test
     public void queryJSONBsp1Disjunction () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1c.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1c.jsonld").getFile());
 
         // There is a repetition in here
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
         assertTrue(sqwi.isOptional());
     };
@@ -51,8 +49,8 @@
     @Test
     public void queryJSONBsp1b () throws QueryException {
 
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1b.jsonld").getFile());
 
         // [base=foo]|([base=foo][base=bar]) meta author=Goethe&year=1815
         assertEquals(sqwi.toQuery().toString(),
@@ -62,20 +60,19 @@
 
     @Test
     public void queryJSONBsp2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp2.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp2.jsonld").getFile());
 
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanOr([tokens:mate/l:foo, tokens:mate/l:bar]), tokens:mate/l:foobar)");
     };
 
 
     @Test
     public void queryJSONBsp3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp3.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp3.jsonld").getFile());
 
         // focus({[base=Mann]})
         assertEquals(sqwi.toQuery().toString(),
@@ -85,8 +82,8 @@
 
     @Test
     public void queryJSONBsp4 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp4.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp4.jsonld").getFile());
 
         // focus({[base=foo]}[orth=bar])
         assertEquals(sqwi.toQuery().toString(),
@@ -96,8 +93,8 @@
 
     @Test
     public void queryJSONBsp5 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp5.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp5.jsonld").getFile());
 
         // focus(1:[base=Der]{1:[base=Mann]}) 
         assertEquals(sqwi.toQuery().toString(),
@@ -107,8 +104,8 @@
 
     @Test
     public void queryJSONBsp6 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp6.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp6.jsonld").getFile());
 
         // [base=katze]
         assertEquals(sqwi.toQuery().toString(), "tokens:mate/l:Katze");
@@ -117,8 +114,8 @@
 
     @Test
     public void queryJSONBsp7 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp7.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp7.jsonld").getFile());
 
         // [!base=Katze]
         assertEquals("tokens:mate/l:Katze", sqwi.toQuery().toString());
@@ -128,8 +125,8 @@
 
     @Test
     public void queryJSONBsp9 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp9.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp9.jsonld").getFile());
 
         // [base=Katze&orth=Katzen]
         assertEquals(sqwi.toQuery().toString(),
@@ -139,8 +136,8 @@
 
     @Test
     public void queryJSONBsp9b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp9b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp9b.jsonld").getFile());
 
         // [base=Katze&orth=Katzen]
         assertEquals(sqwi.toQuery().toString(),
@@ -150,8 +147,8 @@
 
     @Test
     public void queryJSONBsp10 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp10.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp10.jsonld").getFile());
 
         // [base=Katze][orth=und][orth=Hunde]
         assertEquals(sqwi.toQuery().toString(),
@@ -161,8 +158,8 @@
 
     @Test
     public void queryJSONBsp11 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp11.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp11.jsonld").getFile());
 
         // [base!=Katze | orth!=Katzen]
         /*
@@ -178,8 +175,8 @@
 
     @Test
     public void queryJSONBsp12 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp12.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp12.jsonld").getFile());
 
         // contains(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -189,8 +186,8 @@
 
     @Test
     public void queryJSONBsp13 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp13.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp13.jsonld").getFile());
 
         assertEquals(sqwi.toQuery().toString(),
                 "spanStartsWith(<tokens:np />, tokens:p:Det)");
@@ -199,8 +196,8 @@
 
     @Test
     public void queryJSONBsp13b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp13b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp13b.jsonld").getFile());
 
         // startswith(<np>,[pos=Det])
         assertEquals(sqwi.toQuery().toString(),
@@ -210,8 +207,8 @@
 
     @Test
     public void queryJSONBsp14 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp14.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp14.jsonld").getFile());
 
         // 'vers{2,3}uch'
         assertEquals(sqwi.toQuery().toString(),
@@ -221,8 +218,8 @@
 
     @Test
     public void queryJSONBsp15 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp15.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp15.jsonld").getFile());
 
         // [orth='vers.*ch']
         assertEquals(sqwi.toQuery().toString(),
@@ -232,8 +229,8 @@
 
     @Test
     public void queryJSONBsp16 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp16.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp16.jsonld").getFile());
 
         // [(base=bar|base=foo)&orth=foobar]
         assertEquals(sqwi.toQuery().toString(),
@@ -243,8 +240,8 @@
 
     @Test
     public void queryJSONBsp17 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp17.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp17.jsonld").getFile());
 
         // within(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -254,8 +251,8 @@
 
     @Test
     public void queryJSONDemo () throws QueryException {
-        SpanQueryWrapper sqwi = new KrillQuery("tokens")
-                .fromKoral("{ \"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
+        SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(
+                "{ \"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
 
         assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
     };
@@ -263,8 +260,8 @@
 
     @Test
     public void queryJSONBspClass () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-class.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp-class.jsonld").getFile());
 
         // within(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -274,8 +271,8 @@
 
     @Test
     public void queryJSONcosmas3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas3.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas3.json").getFile());
 
         // "das /+w1:3 Buch"
         assertEquals(sqwi.toQuery().toString(),
@@ -285,56 +282,52 @@
 
     @Test
     public void queryJSONcosmas4 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas4.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas4.json").getFile());
 
         // "das /+w1:3,s1:1 Buch"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (base/s:s[1:1], ordered, notExcluded)])");
     };
 
 
     @Test
     public void queryJSONcosmas4b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas4b.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas4b.json").getFile());
 
         // "das /+w1:3,s1 Buch"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (base/s:s[0:1], ordered, notExcluded)])");
     };
 
 
     @Test
     public void queryJSONcosmas10 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas10.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas10.json").getFile());
 
         // "Institut für $deutsche Sprache"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Institut, tokens:s:für), tokens:i:deutsche), tokens:s:Sprache)");
     };
 
 
     @Test
     public void queryJSONcosmas10b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas10b.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas10b.json").getFile());
 
         // "Institut $FÜR $deutsche Sprache"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Institut, tokens:i:für), tokens:i:deutsche), tokens:s:Sprache)");
     };
 
 
     @Test
     public void queryJSONcosmas16 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas16.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas16.json").getFile());
 
         // "$wegen #IN(L) <s>"
         assertEquals(sqwi.toQuery().toString(),
@@ -344,8 +337,8 @@
 
     @Test
     public void queryJSONcosmas17 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas17.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas17.json").getFile());
 
         // "#BED($wegen , +sa)"
         assertEquals(sqwi.toQuery().toString(),
@@ -355,8 +348,8 @@
 
     @Test
     public void queryJSONcosmas20 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas20.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas20.json").getFile());
 
         //     "MORPH(V) #IN(R) #ELEM(S)"
         assertEquals(sqwi.toQuery().toString(),
@@ -366,20 +359,19 @@
 
     @Test
     public void queryJSONrepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-repetition.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bsp-repetition.jsonld").getFile());
 
         // der[cnx/p=A]{0,2}[tt/p=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(tokens:s:der, spanOr([tokens:tt/p:NN, spanNext(spanRepetition(tokens:cnx/p:A{1,2}), tokens:tt/p:NN)]))");
     };
 
 
     @Test
     public void queryJSONboundaryBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-boundary.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bsp-boundary.jsonld").getFile());
 
         // Tal []{1,} Wald
         assertEquals(sqwi.toQuery().toString(),
@@ -389,20 +381,20 @@
 
     @Test
     public void queryJSONcosmasBoundaryBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/cosmas_boundary.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/cosmas_boundary.jsonld").getFile());
 
         // Namen /s1 Leben
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(129: spanElementDistance({129: tokens:s:Namen}, {129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
     };
 
 
     @Test
     public void queryJSONfoundryForOrthBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/foundry_for_orth.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bugs/foundry_for_orth.jsonld")
+                        .getFile());
 
         // opennlp/orth:Baum
         assertEquals(sqwi.toQuery().toString(), "tokens:s:Baum");
@@ -411,8 +403,9 @@
 
     @Test
     public void queryJSONfoundryForOrthBug2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/foundry_for_orth_2.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/foundry_for_orth_2.jsonld")
+                .getFile());
 
         // baum/i
         assertEquals(sqwi.toQuery().toString(), "tokens:i:baum");
@@ -423,8 +416,9 @@
     public void queryJSONunderspecifiedTokenBug () {
         // ((MORPH(APPR) ODER MORPH(APPRART)) /+w1 Urlaub
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/underspecified_token.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/underspecified_token.jsonld")
+                    .getFile());
             new KrillQuery("tokens").fromKoral(json);
         }
         catch (QueryException e) {
@@ -435,10 +429,9 @@
 
     @Test
     public void queryJSONspecialLayerBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/special_layer.jsonld").getFile());
-        assertEquals(
-                sqwi.toQuery().toString(),
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/special_layer.jsonld").getFile());
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Baum, tokens:cnx/p:CC), tokens:tt/l:Baum), <tokens:xip/c:MC />)");
     };
 
@@ -446,11 +439,11 @@
     @Test
     public void queryJSONrepetitionGroupRewriteBug () throws QueryException {
         // ([cnx/p="A"][]){2}
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/repetition_group_rewrite.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/repetition_group_rewrite.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanRepetition(spanExpansion(SpanMultiTermQueryWrapper(tokens:/cnx/p:A/), []{1, 1}, right){2,2})");
     };
 
@@ -458,11 +451,11 @@
     @Test
     public void queryJSONoverlapsFrameWorkaround () throws QueryException {
         // overlaps(<s>,[tt/p=CARD][tt/p="N.*"])
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/overlaps_frame_workaround.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/overlaps_frame_workaround.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOverlap(<tokens:s />, spanNext(tokens:tt/p:CARD, SpanMultiTermQueryWrapper(tokens:/tt/p:N.*/)))");
     };
 
@@ -470,8 +463,9 @@
     @Test
     public void queryJSONflags1 () throws QueryException {
         // buchstabe/i
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/flags/caseInsensitive.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/flags/caseInsensitive.jsonld")
+                        .getFile());
 
         assertEquals(sqwi.toQuery().toString(), "tokens:i:buchstabe");
     };
@@ -480,11 +474,11 @@
     @Test
     public void queryJSONspanWrapDeserializationBug () throws QueryException {
         // contains(<s>, Erde  []* Sonne)
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/unspecified_key_bug.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/unspecified_key_bug.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanContain(<tokens:s />, spanDistance(tokens:s:Erde, tokens:s:Sonne, [(w[1:101], ordered, notExcluded)]))");
     };
 
@@ -493,22 +487,22 @@
     public void queryJSONflags2 () throws QueryException {
         // buchstabe/i
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/flags/unknown1.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/flags/unknown1.jsonld").getFile());
             KrillQuery kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:s:buchstabe");
             assertEquals(kq.getWarning(0).getCode(), 748);
 
-            json = getString(getClass().getResource(
-                    "/queries/flags/unknown2.jsonld").getFile());
+            json = getString(getClass()
+                    .getResource("/queries/flags/unknown2.jsonld").getFile());
             kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:i:buchstabe");
             assertEquals(kq.getWarning(0).getCode(), 748);
 
-            json = getString(getClass().getResource(
-                    "/queries/flags/unknown3.jsonld").getFile());
+            json = getString(getClass()
+                    .getResource("/queries/flags/unknown3.jsonld").getFile());
             kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:i:buchstabe");
@@ -525,8 +519,9 @@
     public void queryJSONelement () throws QueryException {
         // <base/s=s>
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/element/simple-element.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/element/simple-element.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
             assertEquals(kq.fromKoral(json).toQuery().toString(),
@@ -542,12 +537,12 @@
     public void queryJSONinfiniteExpansion () throws QueryException {
         // der []*
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/expansion_bug_3.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/expansion_bug_3.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
-            assertEquals(
-                    kq.fromKoral(json).toQuery().toString(),
+            assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:c, []{0, 4}, right)}))");
         }
         catch (QueryException e) {
@@ -560,8 +555,8 @@
     public void queryJSONcomplexSpanOrTerm () throws QueryException {
         // startsWith(<base/s=s>, { lassen | laufen })
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/span_or_bug.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/span_or_bug.jsonld").getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
             assertEquals(kq.fromKoral(json).toQuery().toString(),
@@ -577,12 +572,13 @@
     public void queryJSONdistancesWithRegexes () throws QueryException {
         // "der" []{2,3} [opennlp/p="NN"]
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/distances_with_regex_bug.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource(
+                            "/queries/bugs/distances_with_regex_bug.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
-            assertEquals(
-                    kq.fromKoral(json).toQuery().toString(),
+            assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "spanDistance(SpanMultiTermQueryWrapper(tokens:/s:der/), SpanMultiTermQueryWrapper(tokens:/opennlp/p:NN/), [(w[3:4], ordered, notExcluded)])");
         }
         catch (QueryException e) {
@@ -590,35 +586,38 @@
         };
     };
 
-	@Test
+
+    @Test
     public void queryJSONregexRewrite1 () throws QueryException {
         // "der" [.+?]
-		String json = getString(getClass().getResource(
-									"/queries/sequence/regex-rewrite-1.jsonld").getFile());
-		KrillQuery kq = new KrillQuery("tokens");
+        String json = getString(getClass()
+                .getResource("/queries/sequence/regex-rewrite-1.jsonld")
+                .getFile());
+        KrillQuery kq = new KrillQuery("tokens");
 
-		assertEquals(
-			kq.fromKoral(json).toQuery().toString(),
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
+        assertEquals(kq.fromKoral(json).toQuery().toString(),
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
     };
 
-	@Test
+
+    @Test
     public void queryJSONregexRewrite2 () throws QueryException {
         // "der" [.*] [.*?] [.+] [.+?]
-		String json = getString(getClass().getResource(
-									"/queries/sequence/regex-rewrite-2.jsonld").getFile());
-		KrillQuery kq = new KrillQuery("tokens");
+        String json = getString(getClass()
+                .getResource("/queries/sequence/regex-rewrite-2.jsonld")
+                .getFile());
+        KrillQuery kq = new KrillQuery("tokens");
 
-		assertEquals(
-			kq.fromKoral(json).toQuery().toString(),
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{4, 4}, right)}))");
+        assertEquals(kq.fromKoral(json).toQuery().toString(),
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{4, 4}, right)}))");
     };
 
 
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
-            BufferedReader in = new BufferedReader(new FileReader(URLDecoder.decode(path,"UTF-8")));
+            BufferedReader in = new BufferedReader(
+                    new FileReader(URLDecoder.decode(path, "UTF-8")));
             String str;
             while ((str = in.readLine()) != null) {
                 contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
index 70b559e..b259fb8 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
@@ -29,8 +29,8 @@
 
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c");
-        assertEquals("spanOr([field:b, field:c])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c])",
+                ssaquery.toQuery().toString());
     };
 
 
@@ -38,8 +38,8 @@
     public void spanAlterQuery3 () throws QueryException {
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c").or("d");
-        assertEquals("spanOr([field:b, field:c, field:d])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c, field:d])",
+                ssaquery.toQuery().toString());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
index b9ef7c4..844b8ec 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
@@ -16,8 +16,10 @@
     @Test
     public void testFirstOperandRef () throws IOException, QueryException {
 
-        String filepath = getClass().getResource(
-                "/queries/reference/first-operand-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/first-operand-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -36,8 +38,10 @@
     @Test
     public void testSecondOperandRef () throws QueryException {
 
-        String filepath = getClass().getResource(
-                "/queries/reference/second-operand-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/second-operand-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -47,14 +51,16 @@
                 "spanReference(spanNext(focus(2: focus(#[1,2]spanSegment({3: tokens:p:P}, "
                         + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
                         + "focus(1: spanNext({2: tokens:p:V}, {1: <tokens:c:NP />}))))))), "
-                        + "{3: tokens:p:P}), 3)", sq.toString());
+                        + "{3: tokens:p:P}), 3)",
+                sq.toString());
     }
 
 
     @Test
     public void testMultipleReferences () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/reference/multiple-references.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/reference/multiple-references.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -74,8 +80,9 @@
 
         // ND: I don't understand what this query should be about ...
         // EM: There was just a bug with multiple distance
-        String filepath = getClass().getResource(
-                "/queries/reference/bug-multiple-distance-simple.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/bug-multiple-distance-simple.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -85,8 +92,9 @@
                 sq.toString());
 
         // "/queries/reference/distance-reference.jsonld").getFile();
-        filepath = getClass().getResource(
-                "/queries/reference/bug-multiple-distance.jsonld").getFile();
+        filepath = getClass()
+                .getResource("/queries/reference/bug-multiple-distance.jsonld")
+                .getFile();
         sqwi = getJSONQuery(filepath);
         sq = sqwi.toQuery();
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
index caaef7b..8be9a79 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
@@ -14,8 +14,9 @@
     @Test
     public void testMatchAnyRelationSourceWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/any-source-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/any-source-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -30,18 +31,20 @@
     @Test
     public void testMatchAnyRelationTargetWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/any-target-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/any-target-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
-        // "focus(#[1,2]spanSegment(focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-        // +
-        // "<tokens:c:vp />)), spanWithAttribute(spanAttribute(tokens:type:case:accusative))))",
-        //
+                // "focus(#[1,2]spanSegment(focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+                // +
+                // "<tokens:c:vp />)), spanWithAttribute(spanAttribute(tokens:type:case:accusative))))",
+                //
                 "focus(#[1,2]spanSegment(spanWithAttribute(spanAttribute(tokens:type:case:accusative)), "
                         + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-                        + "<tokens:c:vp />))))", sq.toString());
+                        + "<tokens:c:vp />))))",
+                sq.toString());
 
         // System.out.println(sq.toString());
     }
@@ -50,24 +53,28 @@
     @Test
     public void testMatchSpecificRelationSourceWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/specific-source-with-attribute.json")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/relation/specific-source-with-attribute.json")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
-        assertEquals("focus(#[1,2]spanSegment(<tokens:c:vp />, "
-                + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-                + "spanElementWithAttribute(<tokens:c:np />, "
-                + "spanAttribute(tokens:type:case:accusative))))))",
+        assertEquals(
+                "focus(#[1,2]spanSegment(<tokens:c:vp />, "
+                        + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+                        + "spanElementWithAttribute(<tokens:c:np />, "
+                        + "spanAttribute(tokens:type:case:accusative))))))",
                 sq.toString());
     }
 
 
     @Test
-    public void testMatchBothRelationNodeWithAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/both-operands-with-attribute.json")
+    public void testMatchBothRelationNodeWithAttribute ()
+            throws QueryException {
+        String filepath = getClass()
+                .getResource(
+                        "/queries/relation/both-operands-with-attribute.json")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -84,8 +91,8 @@
     @Test
     public void testMatchRelationSource () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-source.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-source.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -97,8 +104,8 @@
     @Test
     public void testMatchRelationTarget () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-target.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -110,8 +117,9 @@
     @Test
     public void testMatchRelationSourceAndTarget () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-source-and-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-source-and-target.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -124,8 +132,9 @@
     @Test
     public void testMatchOperandWithProperty () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/operand-with-property.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/operand-with-property.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -138,8 +147,9 @@
     @Test
     public void testMatchOperandWithAttribute () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/operand-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/operand-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -152,8 +162,8 @@
     @Test
     public void testMatchRelationOnly () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/relation-only.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/relation-only.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("focus(#[1,2]spanRelation(tokens:>:mate/d:HEAD))",
@@ -164,8 +174,8 @@
     @Test
     public void testFocusSource () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-source.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-source.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -176,8 +186,8 @@
 
     @Test
     public void testFocusTarget () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-target.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -189,8 +199,9 @@
 
     @Test
     public void testFocusEmptyTarget () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-empty-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-empty-target.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -201,8 +212,9 @@
 
     @Test
     public void testFocusEmptyBoth () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-empty-both.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-empty-both.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
index 9791fa4..f509acb 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
@@ -29,8 +29,8 @@
 
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c");
-        assertEquals("spanOr([field:b, field:c])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c])",
+                ssaquery.toQuery().toString());
     };
 
 
@@ -38,8 +38,8 @@
     public void spanAlterQuery3 () throws QueryException {
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c").or("d");
-        assertEquals("spanOr([field:b, field:c, field:d])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c, field:d])",
+                ssaquery.toQuery().toString());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
index 8c857a2..791af7c 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
@@ -23,8 +23,8 @@
         assertEquals("field:a", ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b", "c");
         assertEquals("spanSegment(spanSegment(field:a, field:b), field:c)",
@@ -40,8 +40,8 @@
         assertEquals("field:a", ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         ssquery.without("c");
         assertEquals("spanNot(spanSegment(field:a, field:b), field:c, 0, 0)",
@@ -114,18 +114,18 @@
     public void spanSegmentCloneQuery () throws QueryException {
         SpanSegmentQueryWrapper ssquery = new SpanSegmentQueryWrapper("field",
                 "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         SpanSegmentQueryWrapper ssquery2 = new SpanSegmentQueryWrapper("field",
                 ssquery);
-        assertEquals(ssquery.toQuery().toString(), ssquery2.toQuery()
-                .toString());
+        assertEquals(ssquery.toQuery().toString(),
+                ssquery2.toQuery().toString());
 
         SpanSegmentQueryWrapper ssquery3 = ssquery2.clone();
-        assertEquals(ssquery.toQuery().toString(), ssquery3.toQuery()
-                .toString());
-        assertEquals(ssquery2.toQuery().toString(), ssquery3.toQuery()
-                .toString());
+        assertEquals(ssquery.toQuery().toString(),
+                ssquery3.toQuery().toString());
+        assertEquals(ssquery2.toQuery().toString(),
+                ssquery3.toQuery().toString());
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
index 94b3437..5230ed0 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
@@ -29,15 +29,15 @@
 
         sssq.append("c");
 
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
     };
 
 
     @Test
     public void spanSegmentSequenceQuery2 () throws QueryException {
-        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field",
-                "-c", "-d", "-e");
+        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field", "-c",
+                "-d", "-e");
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "a", "b");
 
@@ -54,7 +54,8 @@
     public void spanSegmentSequenceQuery3 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "a", "b");
-        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field", "c.?d");
+        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field",
+                "c.?d");
 
         sssq.append(ssreq);
 
@@ -71,8 +72,8 @@
 
         sssq.prepend("a");
 
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
     };
 
 
@@ -80,8 +81,8 @@
     public void spanSegmentSequenceQueryPrepend2 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "d", "e");
-        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field",
-                "-a", "-b", "-c");
+        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field", "-a",
+                "-b", "-c");
 
         sssq.prepend(ssq);
 
@@ -95,7 +96,8 @@
     public void spanSegmentSequenceQueryPrepend3 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "c", "d");
-        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field", "a.?b");
+        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field",
+                "a.?b");
 
         sssq.prepend(ssreq);
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
index 1c6deaf..912642a 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
@@ -32,8 +32,8 @@
         assertFalse(sssq.hasConstraints());
 
         sssq.append("c");
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
         assertFalse(sssq.hasConstraints());
 
         sssq = new SpanSequenceQueryWrapper("field");
@@ -74,14 +74,14 @@
 
         // Synopsis 1
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Synopsis 2
         ssqw = new SpanSequenceQueryWrapper("tokens");
         ssqw.append("der").append("Baum");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Append a sequence
         ssqw = new SpanSequenceQueryWrapper("tokens");
@@ -97,8 +97,8 @@
         // Synopsis 3
         ssqw = new SpanSequenceQueryWrapper("tokens", "Baum");
         ssqw.prepend("der");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Prepend a sequence
         ssqw = new SpanSequenceQueryWrapper("tokens");
@@ -115,16 +115,17 @@
         // Add constraint
         ssqw.withConstraint(2, 4);
         // This may change
-        assertEquals("spanDistance(spanDistance(spanDistance(tokens:der, "
-                + "tokens:Baum, [(w[2:4], ordered, notExcluded)]), "
-                + "tokens:fiel, [(w[2:4], ordered, notExcluded)]), "
-                + "tokens:still, [(w[2:4], ordered, notExcluded)])", ssqw
-                .toQuery().toString());
+        assertEquals(
+                "spanDistance(spanDistance(spanDistance(tokens:der, "
+                        + "tokens:Baum, [(w[2:4], ordered, notExcluded)]), "
+                        + "tokens:fiel, [(w[2:4], ordered, notExcluded)]), "
+                        + "tokens:still, [(w[2:4], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 1);
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 2, "s");
@@ -134,16 +135,20 @@
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 2, "s").withConstraint(2, 3, "x");
-        assertEquals("spanMultipleDistance(tokens:der, tokens:Baum, "
-                + "[(s[1:2], ordered, notExcluded), "
-                + "(x[2:3], ordered, notExcluded)])", ssqw.toQuery().toString());
+        assertEquals(
+                "spanMultipleDistance(tokens:der, tokens:Baum, "
+                        + "[(s[1:2], ordered, notExcluded), "
+                        + "(x[2:3], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens").append("Baum")
                 .prepend("der").withConstraint(1, 2, "s", true)
                 .withConstraint(2, 3, "x");
-        assertEquals("spanMultipleDistance(tokens:der, "
-                + "tokens:Baum, [(s[1:2], ordered, excluded), "
-                + "(x[2:3], ordered, notExcluded)])", ssqw.toQuery().toString());
+        assertEquals(
+                "spanMultipleDistance(tokens:der, "
+                        + "tokens:Baum, [(s[1:2], ordered, excluded), "
+                        + "(x[2:3], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
 
         // Support empty class ins sequence 
@@ -151,8 +156,8 @@
         srqw = new SpanRepetitionQueryWrapper();
         scqw = new SpanClassQueryWrapper(srqw, (short) 3);
         ssqw.append(scqw);
-        assertEquals("spanExpansion(field:Der, []{1, 1}, right, class:3)", ssqw
-                .toQuery().toString());
+        assertEquals("spanExpansion(field:Der, []{1, 1}, right, class:3)",
+                ssqw.toQuery().toString());
 
         // Support empty class ins sequence 
         ssqw = new SpanSequenceQueryWrapper("field");
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
index aff5cf8..6501d77 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -37,8 +37,7 @@
     @Test
     public void queryJSONseqEmptyEnd () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last.jsonld");
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
     };
 
@@ -47,8 +46,7 @@
     public void queryJSONseqEmptyEndClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last-class.jsonld");
         // der{3:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right, class:3)}))");
     };
 
@@ -57,8 +55,7 @@
     public void queryJSONseqEmptyEndRepetition () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last-repetition.jsonld");
         // der[]{3,5}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{3, 5}, right)}))");
     };
 
@@ -92,7 +89,8 @@
 
     @Test
     public void queryJSONseqEmptyStartRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-first-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-first-repetition-2.jsonld");
         // []{0,0}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(), "tokens:tt/p:NN");
     };
@@ -111,8 +109,7 @@
     public void queryJSONseqEmptyMiddleClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-middle-class.jsonld");
         // der{1:[]}[tt/p=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(tokens:s:der, spanExpansion(tokens:tt/p:NN, []{1, 1}, left, class:1))");
     };
 
@@ -130,8 +127,7 @@
     public void queryJSONseqEmptySurround () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround.jsonld");
         // [][tt/p=NN][]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{1, 1}, right)}))");
     };
 
@@ -140,8 +136,7 @@
     public void queryJSONseqEmptySurroundClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-class.jsonld");
         // [][tt/p=NN]{2:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{1, 1}, right, class:2)}))");
     };
 
@@ -150,28 +145,27 @@
     public void queryJSONseqEmptySurroundClass2 () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-class-2.jsonld");
         // {3:[]}[tt/p=NN]{2:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left, class:3), []{1, 1}, right, class:2)}))");
     };
 
 
     @Test
     public void queryJSONseqEmptySurroundRepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition.jsonld");
         // [][tt/p=NN][]{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{2, 7}, right)}))");
     };
 
 
     @Test
     public void queryJSONseqEmptySurroundRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition-2.jsonld");
         // []{3,5}[tt/p=NN][]{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{3, 5}, left), []{2, 7}, right)}))");
     };
 
@@ -179,12 +173,12 @@
     @Test
     public void queryJSONseqEmptySurroundRepetitionClass ()
             throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition-class.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition-class.jsonld");
         // {1:[]}{3,8}[tt/p=NN]{2:[]{2,7}}
         // Ist gleichbedeutend mit
         // {1:[]{3,8}}[tt/p=NN]{2:[]}{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{3, 8}, left, class:1), []{2, 7}, right, class:2)}))");
     };
 
@@ -210,15 +204,15 @@
     public void queryJSONseqNegativeEnd () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("negative-last.jsonld");
         // [tt/p=NN][tt/p!=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right)}))");
     };
 
 
     @Test
     public void queryJSONseqNegativeStartRepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition.jsonld");
         // [tt/p!=NN]{4,5}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(),
                 "spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, left)");
@@ -227,7 +221,8 @@
 
     @Test
     public void queryJSONseqNegativeStartRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition-2.jsonld");
         // [tt/p!=NN]{0,5}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(),
                 "spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{0, 5}, left)");
@@ -236,7 +231,8 @@
 
     @Test
     public void queryJSONseqNegativeStartRepetition3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition-3.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition-3.jsonld");
         // [tt/p!=NN]{0,0}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(), "tokens:tt/p:NN");
     };
@@ -247,18 +243,18 @@
         SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]}
         SpanQuery sq = sqwi.toQuery();
-        assertEquals(
-                sq.toString(),
+        assertEquals(sq.toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right, class:2)}))");
     };
 
 
     @Test
-    public void queryJSONseqNegativeEndRepetitionClass () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition.jsonld");
+    public void queryJSONseqNegativeEndRepetitionClass ()
+            throws QueryException {
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-class-repetition.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]{4,5}}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
     };
 
@@ -266,17 +262,18 @@
     @Test
     public void queryJSONseqNegativeEndRepetitionClass2 ()
             throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-class-repetition-2.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]}{4,5}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
     };
 
 
     @Test
     public void queryJSONseqNegativelastConstraint () {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-constraint.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-constraint.jsonld");
         try {
             sqwi.toQuery().toString();
             fail("Should throw an exception");
@@ -301,7 +298,8 @@
 
     @Test
     public void queryJSONseqNegativeEndSequence2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-sequence-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-sequence-2.jsonld");
         // [tt/p!=NN]([tt/p!=DET][tt/p=NN])
 
         // spanNext(tokens:tt/p:NN, 
@@ -334,7 +332,8 @@
 
     @Test
     public void queryJSONseqSentenceDistanceExcluded () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("distance-sentence-excluded.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "distance-sentence-excluded.jsonld");
 
         assertEquals(
                 "spanElementDistance({129: tokens:s:der}, {129: tokens:s:Baum}, [(base/s:s[0:0], notOrdered, excluded)])",
@@ -356,7 +355,8 @@
     public void queryJSONkoralOptionalityInDistanceBug () {
         try {
             // Sonne [] Mond?
-            SpanQueryWrapper sqwi = jsonQueryFile("distance-with-optionality.jsonld");
+            SpanQueryWrapper sqwi = jsonQueryFile(
+                    "distance-with-optionality.jsonld");
             sqwi.toQuery().toString();
         }
         catch (QueryException qe) {
@@ -369,12 +369,14 @@
 
 
     @Test
-    public void queryJSONkoralOptionalityAfterEmptyBug () throws QueryException {
+    public void queryJSONkoralOptionalityAfterEmptyBug ()
+            throws QueryException {
         // Sonne [] Mond?
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-followed-by-optionality.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-followed-by-optionality.jsonld");
         assertEquals(
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
-			sqwi.toQuery().toString());
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
+                sqwi.toQuery().toString());
         // Could also be a distance at the end ... that's a query planner thing.
     };
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
index 2713702..a1b386d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
@@ -17,8 +17,8 @@
     @Test
     public void testTermQuery () throws QueryException {
         // subspan(tokens:tt/l:Haus, 0, 1)
-        String filepath = getClass().getResource(
-                "/queries/submatch/termquery.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/termquery.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:tt/l:Haus", sq.toString());
@@ -28,8 +28,9 @@
     @Test
     public void testTermStartOffset () throws QueryException {
         // subspan(tokens:tt/l:Haus, -1, 0)
-        String filepath = getClass().getResource(
-                "/queries/submatch/term-start-offset.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/term-start-offset.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:tt/l:Haus", sq.toString());
@@ -39,8 +40,8 @@
     @Test
     public void testTermNull () throws QueryException {
         // subspan(tokens:tt/l:Haus, 1, 1)
-        String filepath = getClass().getResource(
-                "/queries/submatch/term-null.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/term-null.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(null, sq);
@@ -50,8 +51,9 @@
     @Test
     public void testElementQuery () throws QueryException {
         // submatch(1,4:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/simpleElement.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/simpleElement.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -63,8 +65,8 @@
     @Test
     public void testNoLength () throws QueryException {
         // submatch(1,:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/noLength.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/noLength.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("subspan(<tokens:s />, 1, 0)", sq.toString());
@@ -74,8 +76,8 @@
     @Test
     public void testMinusStartOffset () throws QueryException {
         // submatch(-1,4:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/minusStart.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/minusStart.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("subspan(<tokens:s />, -1, 4)", sq.toString());
@@ -86,8 +88,9 @@
     public void testEmptyMinusStartOffset () throws QueryException {
         // no optimization
         // submatch(-1,4:der []{1,8})
-        String filepath = getClass().getResource(
-                "/queries/submatch/empty-minusStart.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/empty-minusStart.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -100,8 +103,8 @@
     public void testEmptyMax () throws QueryException {
         // no optimization
         // submatch(1,2:der []{1,8})
-        String filepath = getClass().getResource(
-                "/queries/submatch/empty-max.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/empty-max.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -112,8 +115,8 @@
 
     @Test
     public void testCaseEmptyWrapped () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/submatch/wrapped.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/wrapped.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -126,12 +129,14 @@
     @Test
     public void testCaseEmptyEmbedded () throws QueryException {
         // die subspan(der []{1,}, 2,3)
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
-        assertEquals("spanNext({1: tokens:s:die}, {1: subspan(spanExpansion("
-                + "tokens:s:der, []{1, 100}, right), 2, 3)})", sq.toString());
+        assertEquals(
+                "spanNext({1: tokens:s:die}, {1: subspan(spanExpansion("
+                        + "tokens:s:der, []{1, 100}, right), 2, 3)})",
+                sq.toString());
     }
 
 
@@ -139,8 +144,9 @@
     public void testCaseEmptyEmbeddedNull () throws QueryException {
         // die subspan([],5,6)
         // start offset is bigger than the original span
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-null.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-null.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:s:die", sq.toString());
@@ -150,8 +156,9 @@
     @Test
     public void testCaseEmptyEmbeddedValid () throws QueryException {
         // die subspan([]{0,5},2)
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-valid-empty.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-valid-empty.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -163,8 +170,9 @@
     @Test
     public void testNegativeToken () throws QueryException {
         // submatch(0,1:[base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-token.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-token.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:l:Baum", sq.toString());
@@ -174,8 +182,8 @@
     @Test
     public void testNegativeSequence () throws QueryException {
         // das submatch(0,1:[base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-seq.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-seq.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -187,8 +195,9 @@
     @Test
     public void testNegativeSequenceWithClass () throws QueryException {
         // das {1:submatch(0,1:[base != Baum])}
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-sequence-class.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-sequence-class.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -200,8 +209,9 @@
     @Test
     public void testNegativeEmbeddedSequence () throws QueryException {
         // submatch(1,1:das [base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-seq.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-negative-seq.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -213,8 +223,9 @@
     @Test
     public void testNegativeEmbeddedSequenceWithClass () throws QueryException {
         // submatch(0,1:{1:[base != Baum] dass})
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-class-seq.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/submatch/embedded-negative-class-seq.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -227,8 +238,9 @@
     @Test
     public void testEmbeddedNegativeRepetition () throws QueryException {
         // submatch(1,1:das [base != Baum]{1,3})
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-repetition.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/submatch/embedded-negative-repetition.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -241,8 +253,9 @@
     @Test
     public void testNegativeRepetition () throws QueryException {
         // das submatch(1,4:[base != Baum]{1,3})
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-repetition.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-repetition.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
index 7e146ad..10b80c7 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
@@ -13,8 +13,10 @@
 
     @Test
     public void testElementSingleAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-single-attribute.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-single-attribute.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -25,8 +27,9 @@
 
     @Test
     public void testElementSingleNotAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-single-not-attribute.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-single-not-attribute.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -53,8 +56,9 @@
 
     @Test
     public void testElementMultipleOrAttributes () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-multiple-or-attributes.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-multiple-or-attributes.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -68,8 +72,9 @@
 
     @Test
     public void testAnyElementWithAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/any-element-with-attribute.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/any-element-with-attribute.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -79,7 +84,8 @@
 
 
     @Test
-    public void testAnyElementWithMultipleOrAttributes () throws QueryException {
+    public void testAnyElementWithMultipleOrAttributes ()
+            throws QueryException {
         String filepath = getClass()
                 .getResource(
                         "/queries/attribute/any-element-with-multiple-or-attributes.jsonld")
@@ -95,7 +101,8 @@
 
 
     @Test
-    public void testAnyElementMultipleAndNotAttributes () throws QueryException {
+    public void testAnyElementMultipleAndNotAttributes ()
+            throws QueryException {
         String filepath = getClass()
                 .getResource(
                         "/queries/attribute/any-element-with-multiple-and-not-attributes.jsonld")
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
index 114ea99..24f296c 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
@@ -18,8 +18,8 @@
     @Test
     public void spanSegmentWithinQuery () throws QueryException {
 
-        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper(
-                "field", "a", "b", "c");
+        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper("field",
+                "a", "b", "c");
         SpanWithinQuery ssequery = new SpanWithinQuery("s", ssquery.toQuery());
 
         assertEquals(
@@ -37,11 +37,11 @@
     @Test
     public void spanSegmentStartsWithQuery () throws QueryException {
 
-        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper(
-                "field", "a", "b", "c");
-        SpanWithinQuery ssequery = new SpanWithinQuery(new SpanElementQuery(
-                "field", "s"), ssquery.toQuery(), SpanWithinQuery.STARTSWITH,
-                true);
+        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper("field",
+                "a", "b", "c");
+        SpanWithinQuery ssequery = new SpanWithinQuery(
+                new SpanElementQuery("field", "s"), ssquery.toQuery(),
+                SpanWithinQuery.STARTSWITH, true);
 
         assertEquals(
                 "spanStartsWith(<field:s />, spanNext(spanNext(field:a, field:b), field:c))",
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
index d651318..20cd49f 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
@@ -33,7 +33,8 @@
 public class TestTemporaryQueryLimitations {
 
     @Test
-    public void classRefCheckNotSupported () throws IOException, QueryException {
+    public void classRefCheckNotSupported ()
+            throws IOException, QueryException {
 
         // Construct index
         KrillIndex ki = new KrillIndex();
@@ -48,8 +49,9 @@
         FieldDocument fd = ki.addDoc(json);
         ki.commit();
 
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/cosmas_classrefcheck.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_classrefcheck.jsonld")
+                .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -58,12 +60,13 @@
         assertEquals(kr.getTotalResults(), 0);
         assertEquals(kr.getStartIndex(), 0);
 
-        assertEquals("This is a warning coming from the serialization", kr
-                .getWarning(1).getMessage());
+        assertEquals("This is a warning coming from the serialization",
+                kr.getWarning(1).getMessage());
 
-        assertEquals("Class reference checks are currently not supported"
-                + " - results may not be correct", kr.getWarning(0)
-                .getMessage());
+        assertEquals(
+                "Class reference checks are currently not supported"
+                        + " - results may not be correct",
+                kr.getWarning(0).getMessage());
 
         assertEquals(2, kr.getWarnings().size());
     };
diff --git a/src/test/java/de/ids_mannheim/korap/response/TestMessage.java b/src/test/java/de/ids_mannheim/korap/response/TestMessage.java
index 8da908a..892250d 100644
--- a/src/test/java/de/ids_mannheim/korap/response/TestMessage.java
+++ b/src/test/java/de/ids_mannheim/korap/response/TestMessage.java
@@ -38,8 +38,7 @@
         assertEquals("[[612,\"Foo\"],[613,\"Bar\",\"Instanz\"]]",
                 km.toJsonString());
         km.add(614, "Test");
-        assertEquals(
-                "[[612,\"Foo\"],[613,\"Bar\",\"Instanz\"],[614,\"Test\"]]",
+        assertEquals("[[612,\"Foo\"],[613,\"Bar\",\"Instanz\"],[614,\"Test\"]]",
                 km.toJsonString());
     };
 
diff --git a/src/test/java/de/ids_mannheim/korap/response/TestNotifications.java b/src/test/java/de/ids_mannheim/korap/response/TestNotifications.java
index ed305de..87e09c1 100644
--- a/src/test/java/de/ids_mannheim/korap/response/TestNotifications.java
+++ b/src/test/java/de/ids_mannheim/korap/response/TestNotifications.java
@@ -37,8 +37,9 @@
         notes.addWarning(613, "Foo");
         notes.addWarning(614, "Bar", "Spiel");
 
-        assertEquals("{\"warnings\":[[613,\"Foo\"],[614,\"Bar\","
-                + "\"Spiel\"]]}", notes.toJsonString());
+        assertEquals(
+                "{\"warnings\":[[613,\"Foo\"],[614,\"Bar\"," + "\"Spiel\"]]}",
+                notes.toJsonString());
 
         assertTrue(notes.hasWarnings());
         assertFalse(notes.hasMessages());
diff --git a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
index c8cf691..a26a945 100644
--- a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
+++ b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
@@ -162,7 +162,8 @@
         assertEquals(kresp.getWarning(0).getMessage(), "This is a warning");
         assertEquals(kresp.getWarning(1).getMessage(),
                 "This is a second warning");
-        assertEquals(kresp.getWarning(2).getMessage(), "Response time exceeded");
+        assertEquals(kresp.getWarning(2).getMessage(),
+                "Response time exceeded");
         assertEquals("0.49", kresp.getVersion());
         assertEquals("seaweed", kresp.getName());
         assertEquals("40.5s", kresp.getBenchmark());
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index ab52dd0..de69724 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -83,8 +83,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
@@ -123,22 +122,21 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/metaquery3.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/metaquery3.jsonld").getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 66);
         assertEquals(5, kr.getItemsPerPage());
         assertEquals(5, kr.getStartIndex());
-        assertEquals("... a: A ist [[der klangreichste]] der V ...", kr
-                .getMatch(0).getSnippetBrackets());
+        assertEquals("... a: A ist [[der klangreichste]] der V ...",
+                kr.getMatch(0).getSnippetBrackets());
     };
 
 
@@ -149,20 +147,19 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439", "00012-fakemeta", "00030-fakemeta",
-        /*
-          "02035-substring",
-          "05663-unbalanced",
-          "07452-deep"
-        */
+                /*
+                  "02035-substring",
+                  "05663-unbalanced",
+                  "07452-deep"
+                */
         }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/metaquery4.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/metaquery4.jsonld").getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -176,15 +173,15 @@
 
         assertEquals(kr.getTotalResults(), 5);
 
-        json = getJsonString(getClass().getResource("/queries/metaquery5.jsonld")
-                .getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/metaquery5.jsonld").getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 1);
 
-        json = getJsonString(getClass().getResource("/queries/metaquery6.jsonld")
-                .getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/metaquery6.jsonld").getFile());
         ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 1);
@@ -207,8 +204,7 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
@@ -225,14 +221,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-fail1.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bsp-fail1.jsonld").getFile());
 
         Result kr = new Krill(json).apply(ki);
         assertEquals(0, kr.getStartIndex());
@@ -248,14 +243,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-fail2.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bsp-fail2.jsonld").getFile());
 
         Result kr = new Krill(json).apply(ki);
         assertEquals(50, kr.getItemsPerPage());
@@ -271,8 +265,8 @@
     public void queryJSONmirrorTestBug () throws IOException {
         // Construct index
         KrillIndex ki = new KrillIndex();
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/failing_mirror.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/failing_mirror.jsonld").getFile());
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
 
@@ -281,8 +275,9 @@
 
         assertEquals("Unable to parse JSON", res.at("/errors/0/1").asText());
 
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/failing_mirror_2.jsonld").getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/bugs/failing_mirror_2.jsonld")
+                        .getFile());
         ks = new Krill(json);
         kr = ks.apply(ki);
 
@@ -305,23 +300,23 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-context.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bsp-context.jsonld").getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), 10);
-        assertEquals("A bzw. a ist der erste Buchstabe des"
-                + " lateinischen [[Alphabets]] und ein Vokal."
-                + " Der Buchstabe A hat in deutschen Texten"
-                + " eine durchschnittliche Häufigkeit  ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals(
+                "A bzw. a ist der erste Buchstabe des"
+                        + " lateinischen [[Alphabets]] und ein Vokal."
+                        + " Der Buchstabe A hat in deutschen Texten"
+                        + " eine durchschnittliche Häufigkeit  ...",
+                kr.getMatch(0).getSnippetBrackets());
 
         ks.getMeta().setCount(5);
         ks.getMeta().setStartPage(2);
@@ -336,17 +331,19 @@
         kr = new Krill(json).apply(ki);
 
         assertEquals(kr.getTotalResults(), -1);
-        assertEquals("... lls seit den Griechen beibehalten worden."
-                + " 3. Bedeutungen in der Biologie steht A für"
-                + " das Nukleosid Adenosin steht A die Base"
-                + " Adenin steht A für die Aminosäure Alanin"
-                + " in der Informatik steht a für den dezimalen"
-                + " [[Wert]] 97 sowohl im ASCII- als auch im"
-                + " Unicode-Zeichensatz steht A für den dezimalen"
-                + " Wert 65 sowohl im ASCII- als auch im"
-                + " Unicode-Zeichensatz als Kfz-Kennzeichen"
-                + " steht A in Deutschland für Augsburg."
-                + " in Österreich auf ...", kr.getMatch(0).getSnippetBrackets());
+        assertEquals(
+                "... lls seit den Griechen beibehalten worden."
+                        + " 3. Bedeutungen in der Biologie steht A für"
+                        + " das Nukleosid Adenosin steht A die Base"
+                        + " Adenin steht A für die Aminosäure Alanin"
+                        + " in der Informatik steht a für den dezimalen"
+                        + " [[Wert]] 97 sowohl im ASCII- als auch im"
+                        + " Unicode-Zeichensatz steht A für den dezimalen"
+                        + " Wert 65 sowohl im ASCII- als auch im"
+                        + " Unicode-Zeichensatz als Kfz-Kennzeichen"
+                        + " steht A in Deutschland für Augsburg."
+                        + " in Österreich auf ...",
+                kr.getMatch(0).getSnippetBrackets());
     };
 
 
@@ -357,14 +354,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-paging.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bsp-paging.jsonld").getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -372,16 +368,16 @@
         assertEquals(5, kr.getStartIndex());
         assertEquals(5, kr.getItemsPerPage());
 
-        json = getJsonString(getClass().getResource("/queries/bsp-cutoff.jsonld")
-                .getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/bsp-cutoff.jsonld").getFile());
         ks = ks = new Krill(json);
         kr = ks.apply(ki);
         assertEquals(kr.getTotalResults(), -1);
         assertEquals(2, kr.getStartIndex());
         assertEquals(2, kr.getItemsPerPage());
 
-        json = getJsonString(getClass().getResource("/queries/metaquery9.jsonld")
-                .getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/metaquery9.jsonld").getFile());
         KrillCollection kc = new KrillCollection(json);
         kc.setIndex(ki);
         assertEquals(7, kc.numberOf("documents"));
@@ -395,13 +391,12 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-itemsPerResource.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bsp-itemsPerResource.jsonld").getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -480,8 +475,8 @@
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-uid-example.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bsp-uid-example.jsonld").getFile());
 
         Krill ks = new Krill(json);
         ks.getMeta().setItemsPerResource(1);
@@ -527,13 +522,14 @@
         assertNull(fd.getTextClass());
         assertEquals(fd.getLanguage(), "de");
         assertEquals(fd.getPubPlace(), "München");
-        assertEquals(fd.getReference(), "Goethe, Johann Wolfgang von:"
-                + " Autobiographische Einzelheiten,"
-                + " (Geschrieben bis 1832), In: Goethe,"
-                + " Johann Wolfgang von: Goethes Werke,"
-                + " Bd. 10, Autobiographische Schriften"
-                + " II, Hrsg.: Trunz, Erich. München: "
-                + "Verlag C. H. Beck, 1982, S. 529-547");
+        assertEquals(fd.getReference(),
+                "Goethe, Johann Wolfgang von:"
+                        + " Autobiographische Einzelheiten,"
+                        + " (Geschrieben bis 1832), In: Goethe,"
+                        + " Johann Wolfgang von: Goethes Werke,"
+                        + " Bd. 10, Autobiographische Schriften"
+                        + " II, Hrsg.: Trunz, Erich. München: "
+                        + "Verlag C. H. Beck, 1982, S. 529-547");
         assertEquals(fd.getPublisher(), "Verlag C. H. Beck");
         assertNull(fd.getEditor());
         assertNull(fd.getFileEditionStatement());
@@ -619,8 +615,7 @@
 
         assertEquals(fd.getTokenSource(), "opennlp#tokens");
 
-        assertEquals(
-                fd.getFoundries(),
+        assertEquals(fd.getFoundries(),
                 "base base/paragraphs base/sentences corenlp "
                         + "corenlp/constituency corenlp/morpho corenlp/namedentities"
                         + " corenlp/sentences glemm glemm/morpho mate mate/morpho"
@@ -665,8 +660,8 @@
                 getClass().getResourceAsStream("/bzk/D59-00089.json.gz"), true);
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/cosmas_boundary.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_boundary.jsonld").getFile());
 
         QueryBuilder kq = new QueryBuilder("tokens");
         Krill ks = new Krill(kq.focus(1,
@@ -678,8 +673,7 @@
         assertEquals(40, kr.getMatch(0).getStartPos());
         assertEquals(41, kr.getMatch(0).getEndPos());
 
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... Initiative\" eine neue politische Gruppierung ins "
                         + "[[{1:Leben}]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
 
@@ -690,19 +684,16 @@
         kr = ks.apply(ki);
         assertEquals(kr.getSerialQuery(),
                 "focus(129: spanContain(<tokens:base/s:s />, {129: tokens:s:Leben}))");
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... Initiative\" eine neue politische Gruppierung ins "
                         + "[[Leben]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
 
         ks = new Krill(json);
         kr = ks.apply(ki);
-        assertEquals(
-                kr.getSerialQuery(),
+        assertEquals(kr.getSerialQuery(),
                 "focus(129: spanElementDistance({129: tokens:s:Namen}, "
                         + "{129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... ihren Austritt erklärt und unter dem [[Namen \"Einheitsbewegung "
                         + "der sozialistischen Initiative\" eine neue politische Gruppierung "
                         + "ins Leben]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
@@ -723,16 +714,16 @@
 
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/multiple_classes.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bugs/multiple_classes.jsonld")
+                        .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
         assertEquals(kr.getSerialQuery(),
                 "{4: spanNext({1: spanNext({2: tokens:s:ins}, "
                         + "{3: tokens:s:Leben})}, tokens:s:gerufen)}");
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "... sozialistischen Initiative\" eine neue politische"
                         + " Gruppierung [[{4:{1:{2:ins} {3:Leben}} gerufen}]] hatten. "
                         + "Pressemeldungen zufolge haben sich in ...");
@@ -753,8 +744,9 @@
 
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/multiple_classes.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bugs/multiple_classes.jsonld")
+                        .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -763,8 +755,9 @@
         JsonNode res = mapper.readTree(kr.toTokenListJsonString());
 
         assertEquals(1, res.at("/meta/totalResults").asInt());
-        assertEquals("{4: spanNext({1: spanNext({2: tokens:s:ins}, "
-                + "{3: tokens:s:Leben})}, tokens:s:gerufen)}",
+        assertEquals(
+                "{4: spanNext({1: spanNext({2: tokens:s:ins}, "
+                        + "{3: tokens:s:Leben})}, tokens:s:gerufen)}",
                 res.at("/meta/serialQuery").asText());
         assertEquals(0, res.at("/meta/startIndex").asInt());
         assertEquals(25, res.at("/meta/itemsPerPage").asInt());
@@ -795,8 +788,9 @@
         assertEquals("BZK", fd.getCorpusSigle());
 
         // [tt/p="A.*"]{0,3}[tt/p="N.*"]
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/multiterm_rewrite.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bugs/multiterm_rewrite.jsonld")
+                        .getFile());
 
         Krill ks = new Krill(json);
         KrillCollection kc = ks.getCollection();
@@ -839,8 +833,7 @@
         assertEquals(kr.getMatch(3).getSnippetBrackets(),
                 "Saragat-Partei zerfällt Rom ([[ADN]]) "
                         + "die von dem Rechtssozialisten Saragat geführte ...");
-        assertEquals(
-                kr.getMatch(23).getSnippetBrackets(),
+        assertEquals(kr.getMatch(23).getSnippetBrackets(),
                 "... dem Namen \"Einheitsbewegung der sozialistischen "
                         + "Initiative\" [[eine neue politische Gruppierung]] "
                         + "ins Leben gerufen hatten. Pressemeldungen zufolge ...");
@@ -858,8 +851,9 @@
         ki.commit();
 
         // ({1:Sonne []* Erde} | {2: Erde []* Sonne})
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/tokendistancespan_bug.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/tokendistancespan_bug.jsonld")
+                .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -876,13 +870,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
-        String json = getJsonString(getClass().getResource(
-                "/queries/metaquery8-nocollection.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/metaquery8-nocollection.jsonld")
+                .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -890,8 +884,8 @@
         assertEquals(0, kr.getStartIndex());
         assertEquals(10, kr.getItemsPerPage());
 
-        json = getJsonString(getClass().getResource("/queries/metaquery8.jsonld")
-                .getFile());
+        json = getJsonString(
+                getClass().getResource("/queries/metaquery8.jsonld").getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
@@ -901,8 +895,8 @@
         assertEquals(0, kr.getStartIndex());
         assertEquals(10, kr.getItemsPerPage());
 
-        json = getJsonString(getClass().getResource(
-                "/queries/metaquery8-filtered.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/metaquery8-filtered.jsonld").getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
@@ -912,8 +906,9 @@
         assertEquals(0, kr.getStartIndex());
         assertEquals(10, kr.getItemsPerPage());
 
-        json = getJsonString(getClass().getResource(
-                "/queries/metaquery8-filtered-further.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/metaquery8-filtered-further.jsonld")
+                .getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
@@ -923,8 +918,9 @@
         assertEquals(10, kr.getItemsPerPage());
 
 
-        json = getJsonString(getClass().getResource(
-                "/queries/metaquery8-filtered-nested.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/metaquery8-filtered-nested.jsonld")
+                .getFile());
 
         ks = new Krill(json);
         kr = ks.apply(ki);
@@ -952,14 +948,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-context-2.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bsp-context-2.jsonld").getFile());
 
         Krill ks = new Krill(json);
         ks.getMeta().setCutOff(false);
@@ -975,11 +970,11 @@
         assertEquals(0, kr.getStartIndex());
         assertEquals(25, kr.getItemsPerPage());
 
-        assertFalse(kr.getContext().toJsonNode().toString()
-                .equals("\"base/s:s\""));
+        assertFalse(
+                kr.getContext().toJsonNode().toString().equals("\"base/s:s\""));
 
-        json = getJsonString(getClass().getResource(
-                "/queries/bsp-context-sentence.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bsp-context-sentence.jsonld").getFile());
 
         kr = new Krill(json).apply(ki);
         assertEquals(kr.getContext().toJsonNode().toString(), "\"base/s:s\"");
@@ -1004,14 +999,13 @@
         // Indexing test files
         for (String i : new String[] { "00001", "00002", "00003", "00004",
                 "00005", "00006", "02439" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bsp-bug.jsonld").getFile());
+        String json = getJsonString(
+                getClass().getResource("/queries/bsp-bug.jsonld").getFile());
 
         Result kr = new Krill(json).apply(ki);
 
@@ -1027,20 +1021,19 @@
         // Indexing test files
         for (String i : new String[] { "00001" }) {
             // , "00002", "00003", "00004", "00005", "00006", "02439"
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
         // "der" []{2,3} [opennlp/p="NN"]
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/distances_with_regex_bug.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/distances_with_regex_bug.jsonld")
+                .getFile());
 
         Result kr = new Krill(json).apply(ki);
 
-        assertEquals(
-                kr.getMatch(0).getSnippetBrackets(),
+        assertEquals(kr.getMatch(0).getSnippetBrackets(),
                 "Mit Ausnahme von Fremdwörtern und Namen ist das A der einzige Buchstabe im Deutschen, [[der zweifach am Anfang]] eines Wortes stehen darf, etwa im Wort Aal.");
 
     };
@@ -1059,14 +1052,15 @@
 
         // Expansion bug
         // der alte Digraph Aa durch Å
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/expansion_bug_2.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/expansion_bug_2.jsonld").getFile());
 
         Result kr = new Krill(json).apply(ki);
-        assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
-                + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
-                + "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals(
+                "... Buchstabe des Alphabetes. In Dänemark ist "
+                        + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+                        + "in Eigennamen und Ortsnamen ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
         assertEquals(kr.getTotalResults(), 1);
 
@@ -1079,52 +1073,54 @@
 
         // der alte Digraph Aa durch []
         // Works with one document
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/expansion_bug.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/expansion_bug.jsonld").getFile());
 
         kr = new Krill(json).apply(ki);
 
         // focus(254: spanContain(<tokens:base/s:t />, {254: spanNext(spanNext(spanNext(spanNext(tokens:s:der, tokens:s:alte), tokens:s:Digraph), tokens:s:Aa), spanExpansion(tokens:s:durch, []{1, 1}, right))}))
 
-        assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
-                + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
-                + "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals(
+                "... Buchstabe des Alphabetes. In Dänemark ist "
+                        + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+                        + "in Eigennamen und Ortsnamen ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
         assertEquals(kr.getTotalResults(), 1);
 
         // Now try with one file ahead
         ki = new KrillIndex();
         for (String i : new String[] { "00001", "00002" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
         // Expansion bug
         // der alte Digraph Aa durch Å
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/expansion_bug_2.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/expansion_bug_2.jsonld").getFile());
 
         kr = new Krill(json).apply(ki);
 
-        assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
-                + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
-                + "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals(
+                "... Buchstabe des Alphabetes. In Dänemark ist "
+                        + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+                        + "in Eigennamen und Ortsnamen ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
         assertEquals(kr.getTotalResults(), 1);
 
         // der alte Digraph Aa durch []
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/expansion_bug.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/expansion_bug.jsonld").getFile());
 
         kr = new Krill(json).apply(ki);
-        assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
-                + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
-                + "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
-                .getSnippetBrackets());
+        assertEquals(
+                "... Buchstabe des Alphabetes. In Dänemark ist "
+                        + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+                        + "in Eigennamen und Ortsnamen ...",
+                kr.getMatch(0).getSnippetBrackets());
         assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
         assertEquals(kr.getTotalResults(), 1);
     };
@@ -1137,14 +1133,15 @@
         ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
         ki.commit();
 
-        String json = getJsonString(getClass().getResource(
-                "/queries/bugs/zero_repetition_bug.jsonld").getFile());
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/zero_repetition_bug.jsonld")
+                .getFile());
 
         Result kr = new Krill(json).apply(ki);
 
         assertEquals(783, kr.getError(0).getCode());
-        assertEquals("This query can't match anywhere", kr.getError(0)
-                .getMessage());
+        assertEquals("This query can't match anywhere",
+                kr.getError(0).getMessage());
     };
 
 
@@ -1157,8 +1154,9 @@
         // Construct index
         KrillIndex ki = new KrillIndex();
         // Indexing test files
-        ki.addDoc(getClass()
-                .getResourceAsStream("/sgbr/BSP-2013-01-32.json.gz"), true);
+        ki.addDoc(
+                getClass().getResourceAsStream("/sgbr/BSP-2013-01-32.json.gz"),
+                true);
         ki.commit();
 
         Krill k = new Krill(new QueryBuilder("tokens").tag("base/s:s"));
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
index b297672..7a70f13 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
@@ -41,14 +41,13 @@
         KrillIndex ki = new KrillIndex();
         // Indexing test files
         for (String i : new String[] { "00001", "00002" }) {
-            ki.addDoc(
-                    getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
+            ki.addDoc(getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-        String jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/fields.jsonld").getFile());
+        String jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/fields.jsonld").getFile());
 
         Krill ks = new Krill(jsonString);
 
@@ -87,8 +86,8 @@
         assertTrue(res.at("/matches/0/layerInfos").isMissingNode());
         assertTrue(res.at("/matches/0/tokenization").isMissingNode());
 
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/fields_2.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/fields_2.jsonld").getFile());
         ks = new Krill(jsonString);
         kr = ks.apply(ki);
         assertEquals((long) 17, kr.getTotalResults());
@@ -99,13 +98,13 @@
         res = mapper.readTree(kr.toJsonString());
         assertEquals(0, res.at("/matches/0/UID").asInt());
         assertTrue(res.at("/matches/0/corpusID").isMissingNode());
-        assertEquals("Ruru,Jens.Ol,Aglarech", res.at("/matches/0/author")
-                .asText());
+        assertEquals("Ruru,Jens.Ol,Aglarech",
+                res.at("/matches/0/author").asText());
         assertEquals("A", res.at("/matches/0/title").asText());
         assertEquals("WPD_AAA.00001", res.at("/matches/0/docID").asText());
         assertTrue(res.at("/matches/0/textSigle").isMissingNode());
-        assertEquals("match-WPD_AAA.00001-p6-7", res.at("/matches/0/matchID")
-                .asText());
+        assertEquals("match-WPD_AAA.00001-p6-7",
+                res.at("/matches/0/matchID").asText());
         // assertEquals("p6-7", res.at("/matches/0/matchID").asText());
         assertEquals("", res.at("/matches/0/subTitle").asText());
         assertEquals("", res.at("/matches/0/textClass").asText());
@@ -125,8 +124,8 @@
         ki.addDoc(getClass().getResourceAsStream("/goe/AGX-00002.json"), false);
         ki.commit();
 
-        String jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/fields_no.jsonld").getFile());
+        String jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/fields_no.jsonld").getFile());
 
         Krill ks = new Krill(jsonString);
         Result kr = ks.apply(ki);
@@ -134,85 +133,87 @@
         JsonNode res = mapper.readTree(kr.toJsonString());
         assertEquals(0, res.at("/matches/0/UID").asInt());
         assertEquals("GOE_AGX.00002", res.at("/matches/0/textSigle").asText());
-        assertEquals("Maximen und Reflexionen", res.at("/matches/0/title")
-                .asText());
+        assertEquals("Maximen und Reflexionen",
+                res.at("/matches/0/title").asText());
         assertEquals("1982", res.at("/matches/0/pubDate").asText());
-        assertEquals("Goethe, Johann Wolfgang von", res.at("/matches/0/author")
-                .asText());
+        assertEquals("Goethe, Johann Wolfgang von",
+                res.at("/matches/0/author").asText());
         assertEquals("GOE_AGX", res.at("/matches/0/docSigle").asText());
         assertEquals("GOE", res.at("/matches/0/corpusSigle").asText());
-        assertEquals("Religion und Christentum", res.at("/matches/0/subTitle")
-                .asText());
+        assertEquals("Religion und Christentum",
+                res.at("/matches/0/subTitle").asText());
         assertEquals("München", res.at("/matches/0/pubPlace").asText());
         assertEquals(
                 "base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans",
                 res.at("/matches/0/layerInfos").asText());
         assertTrue(res.at("/matches/0/textType").isMissingNode());
-        assertEquals("match-GOE_AGX.00002-p7-8", res.at("/matches/0/matchID")
-                .asText());
+        assertEquals("match-GOE_AGX.00002-p7-8",
+                res.at("/matches/0/matchID").asText());
 
 
         // All fields
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/fields_all.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/fields_all.jsonld").getFile());
 
         ks = new Krill(jsonString);
         kr = ks.apply(ki);
         mapper = new ObjectMapper();
         res = mapper.readTree(kr.toJsonString());
-        assertEquals("Verlag C. H. Beck", res.at("/matches/0/publisher")
-                .asText());
+        assertEquals("Verlag C. H. Beck",
+                res.at("/matches/0/publisher").asText());
         assertEquals("Aphorismus", res.at("/matches/0/textType").asText());
         assertEquals("Aphorismen", res.at("/matches/0/textTypeRef").asText());
         assertEquals(
                 "Goethe, Johann Wolfgang von: Maximen und Reflexionen. Religion und Christentum, [Aphorismen], (Erstveröffentlichung: Stuttgart ; Tübingen, 1827-1842), In: Goethe, Johann Wolfgang von: Goethes Werke, Bd. 12, Schriften zur Kunst. Schriften zur Literatur. Maximen und Reflexionen, Hrsg.: Trunz, Erich. München: Verlag C. H. Beck, 1982, S. 372-377",
                 res.at("/matches/0/reference").asText());
         assertEquals("de", res.at("/matches/0/language").asText());
-        assertEquals("opennlp#tokens", res.at("/matches/0/tokenSource")
-                .asText());
+        assertEquals("opennlp#tokens",
+                res.at("/matches/0/tokenSource").asText());
         assertEquals(
                 "base base/paragraphs base/sentences connexor connexor/morpho connexor/phrase connexor/sentences connexor/syntax corenlp corenlp/constituency corenlp/morpho corenlp/namedentities corenlp/sentences glemm glemm/morpho mate mate/morpho opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences xip xip/constituency xip/morpho xip/sentences",
                 res.at("/matches/0/foundries").asText());
-        assertEquals("Goethe-Korpus", res.at("/matches/0/corpusTitle").asText());
+        assertEquals("Goethe-Korpus",
+                res.at("/matches/0/corpusTitle").asText());
         assertEquals("QAO-NC", res.at("/matches/0/license").asText());
         assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)",
                 res.at("/matches/0/docTitle").asText());
         assertEquals("1827", res.at("/matches/0/creationDate").asText());
         assertEquals("372-377", res.at("/matches/0/pages").asText());
-        assertEquals("match-GOE_AGX.00002-p7-8", res.at("/matches/0/matchID")
-                .asText());
+        assertEquals("match-GOE_AGX.00002-p7-8",
+                res.at("/matches/0/matchID").asText());
 
 
         // @All fields
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/fields_at_all.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/fields_at_all.jsonld").getFile());
 
         ks = new Krill(jsonString);
         kr = ks.apply(ki);
         mapper = new ObjectMapper();
         res = mapper.readTree(kr.toJsonString());
 
-        assertEquals("Verlag C. H. Beck", res.at("/matches/0/publisher")
-                .asText());
+        assertEquals("Verlag C. H. Beck",
+                res.at("/matches/0/publisher").asText());
         assertEquals("Aphorismus", res.at("/matches/0/textType").asText());
         assertEquals("Aphorismen", res.at("/matches/0/textTypeRef").asText());
         assertEquals(
                 "Goethe, Johann Wolfgang von: Maximen und Reflexionen. Religion und Christentum, [Aphorismen], (Erstveröffentlichung: Stuttgart ; Tübingen, 1827-1842), In: Goethe, Johann Wolfgang von: Goethes Werke, Bd. 12, Schriften zur Kunst. Schriften zur Literatur. Maximen und Reflexionen, Hrsg.: Trunz, Erich. München: Verlag C. H. Beck, 1982, S. 372-377",
                 res.at("/matches/0/reference").asText());
         assertEquals("de", res.at("/matches/0/language").asText());
-        assertEquals("opennlp#tokens", res.at("/matches/0/tokenSource")
-                .asText());
+        assertEquals("opennlp#tokens",
+                res.at("/matches/0/tokenSource").asText());
         assertEquals(
                 "base base/paragraphs base/sentences connexor connexor/morpho connexor/phrase connexor/sentences connexor/syntax corenlp corenlp/constituency corenlp/morpho corenlp/namedentities corenlp/sentences glemm glemm/morpho mate mate/morpho opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences xip xip/constituency xip/morpho xip/sentences",
                 res.at("/matches/0/foundries").asText());
-        assertEquals("Goethe-Korpus", res.at("/matches/0/corpusTitle").asText());
+        assertEquals("Goethe-Korpus",
+                res.at("/matches/0/corpusTitle").asText());
         assertEquals("QAO-NC", res.at("/matches/0/license").asText());
         assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)",
                 res.at("/matches/0/docTitle").asText());
         assertEquals("1827", res.at("/matches/0/creationDate").asText());
         assertEquals("372-377", res.at("/matches/0/pages").asText());
-        assertEquals("match-GOE_AGX.00002-p7-8", res.at("/matches/0/matchID")
-                .asText());
+        assertEquals("match-GOE_AGX.00002-p7-8",
+                res.at("/matches/0/matchID").asText());
     };
 
 
@@ -245,16 +246,19 @@
         ki.commit();
 
         // textClass = reisen & wissenschaft
-        String jsonString = getJsonString(getClass().getResource(
-                "/queries/collections/collection_textClass.jsonld").getFile());
+        String jsonString = getJsonString(getClass()
+                .getResource("/queries/collections/collection_textClass.jsonld")
+                .getFile());
         Krill ks = new Krill(jsonString);
         KrillCollection kc = ks.getCollection();
         kc.setIndex(ki);
         assertEquals(1, kc.numberOf("documents"));
 
         // textClass = reisen
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/collections/collection_textClass_2.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource(
+                        "/queries/collections/collection_textClass_2.jsonld")
+                .getFile());
         ks = new Krill(jsonString);
         kc = ks.getCollection();
         kc.setIndex(ki);
@@ -267,7 +271,7 @@
                                                                   );
         // OffsetAttribute offsetAttribute = ts.addAttribute(OffsetAttribute.class);
         CharTermAttribute charTermAttribute = ts.addAttribute(CharTermAttribute.class);
-
+        
         ts.reset();
         while (ts.incrementToken()) {
             String term = charTermAttribute.toString();
@@ -276,16 +280,18 @@
         */
 
         // author = wolfgang
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/collections/collection_goethe.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource("/queries/collections/collection_goethe.jsonld")
+                .getFile());
         ks = new Krill(jsonString);
         kc = ks.getCollection();
         kc.setIndex(ki);
         assertEquals(1, kc.numberOf("documents"));
 
         // author = Wolfgang
-        jsonString = getJsonString(getClass().getResource(
-                "/queries/collections/collection_goethe_2.jsonld").getFile());
+        jsonString = getJsonString(getClass()
+                .getResource("/queries/collections/collection_goethe_2.jsonld")
+                .getFile());
         ks = new Krill(jsonString);
         kc = ks.getCollection();
         kc.setIndex(ki);
@@ -303,8 +309,9 @@
     public void searchMetaContext () throws IOException {
 
         // All fields
-        String jsonString = getJsonString(getClass().getResource(
-                "/queries/metas/context_paragraph.jsonld").getFile());
+        String jsonString = getJsonString(getClass()
+                .getResource("/queries/metas/context_paragraph.jsonld")
+                .getFile());
 
         Krill ks = new Krill(jsonString);
         assertTrue(ks.getMeta().getContext().isSpanDefined());
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestResult.java b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
index 12e5b3d..7e1442f 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestResult.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
@@ -36,9 +36,9 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
         fd.addString("UID", "1");
-        fd.addTV("base", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("base", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
@@ -76,8 +76,8 @@
         */
         assertEquals(1, res.at("/matches/0/UID").asInt());
         assertEquals("doc-1", res.at("/matches/0/docID").asText());
-        assertEquals("match-doc-1-p0-1(1)0-0", res.at("/matches/0/matchID")
-                .asText());
+        assertEquals("match-doc-1-p0-1(1)0-0",
+                res.at("/matches/0/matchID").asText());
         assertEquals(
                 "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\">bab</span>",
                 res.at("/matches/0/snippet").asText());
@@ -90,8 +90,8 @@
         */
         assertEquals(2, res.at("/matches/6/UID").asInt());
         assertEquals("doc-2", res.at("/matches/6/docID").asText());
-        assertEquals("match-doc-2-p2-3(1)2-2", res.at("/matches/6/matchID")
-                .asText());
+        assertEquals("match-doc-2-p2-3(1)2-2",
+                res.at("/matches/6/matchID").asText());
         assertEquals(
                 "<span class=\"context-left\">ab</span><span class=\"match\"><mark><mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\"></span>",
                 res.at("/matches/6/snippet").asText());
@@ -104,14 +104,15 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
         fd.addString("UID", "1");
-        fd.addTV("tokens", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("tokens", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
         ki.commit();
 
-        String json = getString(getClass().getResource(
-                "/queries/bugs/optionality_warning.jsonld").getFile());
+        String json = getString(getClass()
+                .getResource("/queries/bugs/optionality_warning.jsonld")
+                .getFile());
         Krill ks = new Krill(json);
 
         Result kr = ks.apply(ki);
@@ -122,8 +123,8 @@
 
         // Old:
         // assertEquals("Optionality of query is ignored", res.at("/warning").asText());
-        assertEquals("Optionality of query is ignored", res.at("/warnings/0/1")
-                .asText());
+        assertEquals("Optionality of query is ignored",
+                res.at("/warnings/0/1").asText());
     };
 
 
@@ -133,9 +134,9 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
         fd.addString("UID", "1");
-        fd.addTV("tokens", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("tokens", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
@@ -147,8 +148,8 @@
         // Commit!
         ki.commit();
 
-        String json = getString(getClass().getResource(
-                "/queries/bsp-result-check.jsonld").getFile());
+        String json = getString(getClass()
+                .getResource("/queries/bsp-result-check.jsonld").getFile());
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
         assertEquals((long) 7, kr.getTotalResults());
@@ -179,19 +180,19 @@
         assertEquals("operation:or", res.at("/query/operation").asText());
 
         assertEquals("koral:token", res.at("/query/operands/0/@type").asText());
-        assertEquals("koral:term", res.at("/query/operands/0/wrap/@type")
-                .asText());
+        assertEquals("koral:term",
+                res.at("/query/operands/0/wrap/@type").asText());
         assertEquals("orth", res.at("/query/operands/0/wrap/layer").asText());
         assertEquals("a", res.at("/query/operands/0/wrap/key").asText());
-        assertEquals("match:eq", res.at("/query/operands/0/wrap/match")
-                .asText());
+        assertEquals("match:eq",
+                res.at("/query/operands/0/wrap/match").asText());
         assertEquals("koral:token", res.at("/query/operands/1/@type").asText());
-        assertEquals("koral:term", res.at("/query/operands/1/wrap/@type")
-                .asText());
+        assertEquals("koral:term",
+                res.at("/query/operands/1/wrap/@type").asText());
         assertEquals("orth", res.at("/query/operands/1/wrap/layer").asText());
         assertEquals("b", res.at("/query/operands/1/wrap/key").asText());
-        assertEquals("match:eq", res.at("/query/operands/1/wrap/match")
-                .asText());
+        assertEquals("match:eq",
+                res.at("/query/operands/1/wrap/match").asText());
 
         // Matches
         assertEquals(1, res.at("/matches/0/UID").asInt());
@@ -212,9 +213,9 @@
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-1");
         fd.addString("UID", "1");
-        fd.addTV("base", "abab", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]"
-                + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:a|i:c|_2#2-3]"
-                + "[(3-4)s:b|i:a|_3#3-4]");
+        fd.addTV("base", "abab",
+                "[(0-1)s:a|i:a|_0#0-1|-:t$<i>4]" + "[(1-2)s:b|i:b|_1#1-2]"
+                        + "[(2-3)s:a|i:c|_2#2-3]" + "[(3-4)s:b|i:a|_3#3-4]");
         ki.addDoc(fd);
         fd = new FieldDocument();
         fd.addString("ID", "doc-2");
@@ -236,8 +237,8 @@
         JsonNode res = mapper.readTree(kr.toTokenListJsonString());
 
         assertEquals(3, res.at("/meta/totalResults").asInt());
-        assertEquals("spanNext(base:s:a, base:s:b)", res
-                .at("/meta/serialQuery").asText());
+        assertEquals("spanNext(base:s:a, base:s:b)",
+                res.at("/meta/serialQuery").asText());
         assertEquals(0, res.at("/meta/startIndex").asInt());
         assertEquals(25, res.at("/meta/itemsPerPage").asInt());
 
@@ -264,7 +265,8 @@
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
-            BufferedReader in = new BufferedReader(new FileReader(URLDecoder.decode(path,"UTF-8")));
+            BufferedReader in = new BufferedReader(
+                    new FileReader(URLDecoder.decode(path, "UTF-8")));
             String str;
             while ((str = in.readLine()) != null) {
                 contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/server/TestDatabase.java b/src/test/java/de/ids_mannheim/korap/server/TestDatabase.java
index 36dfac2..e4848d9 100644
--- a/src/test/java/de/ids_mannheim/korap/server/TestDatabase.java
+++ b/src/test/java/de/ids_mannheim/korap/server/TestDatabase.java
@@ -29,7 +29,8 @@
         Class.forName("org.sqlite.JDBC");
         conn = DriverManager.getConnection("jdbc:sqlite::memory:");
         this.stat = conn.createStatement();
-        stat.executeUpdate("CREATE TABLE IF NOT EXISTS people (name TEXT, age INTEGER);");
+        stat.executeUpdate(
+                "CREATE TABLE IF NOT EXISTS people (name TEXT, age INTEGER);");
         conn.setAutoCommit(false);
     };
 
@@ -83,7 +84,8 @@
         this.conn = cpds.getConnection();
         conn.setAutoCommit(false);
         this.stat = conn.createStatement();
-        stat.executeUpdate("CREATE TABLE IF NOT EXISTS result_a (text_id INTEGER, match_count INTEGER);");
+        stat.executeUpdate(
+                "CREATE TABLE IF NOT EXISTS result_a (text_id INTEGER, match_count INTEGER);");
         // conn.setAutoCommit(false);
         PreparedStatement prep = this.conn
                 .prepareStatement("INSERT INTO result_a VALUES (?, ?);");
@@ -137,7 +139,8 @@
         conn = cpds.getConnection();
         conn.setAutoCommit(false);
         Statement stat = conn.createStatement();
-        stat.executeUpdate("CREATE TABLE IF NOT EXISTS matchXYZ (text_id INTEGER, match_count INTEGER);");
+        stat.executeUpdate(
+                "CREATE TABLE IF NOT EXISTS matchXYZ (text_id INTEGER, match_count INTEGER);");
         conn.commit();
         stat.close();
 
diff --git a/src/test/java/de/ids_mannheim/korap/server/TestResource.java b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
index 908f3e9..0ef56d6 100644
--- a/src/test/java/de/ids_mannheim/korap/server/TestResource.java
+++ b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
@@ -114,8 +114,8 @@
 
 
 
-            String json = StringfromFile(getClass().getResource(
-                    "/wiki/" + i + ".json").getFile());
+            String json = StringfromFile(
+                    getClass().getResource("/wiki/" + i + ".json").getFile());
 
             Entity jsonE = Entity.json(json);
 
@@ -134,8 +134,8 @@
             }
         };
 
-        String json = StringfromFile(getClass().getResource("/wiki/02439.json")
-                .getFile());
+        String json = StringfromFile(
+                getClass().getResource("/wiki/02439.json").getFile());
         Entity jsonE = Entity.json(json);
 
         try {
@@ -211,18 +211,18 @@
     public void testRemoving () throws IOException {
         String resp;
         JsonNode res;
-
+    
         String json = StringfromFile(getClass().getResource("/wiki/02439.json")
                 .getFile());
         Entity jsonE = Entity.json(json);
-
+    
         try {
             // Put new documents to the index
             resp = target.path("/index/02439").request("application/json")
                     .put(jsonE, String.class);
-
+    
             res = mapper.readTree(resp);
-
+    
             // Check mirroring
             assertEquals(2439, res.at("/text/UID").asInt());
             assertEquals("milena", res.at("/meta/node").asText());
@@ -231,13 +231,13 @@
         catch (Exception e) {
             fail("Server response failed " + e.getMessage() + " (Known issue)");
         };
-
+    
         // Commit!
         resp = target.path("/index").request("application/json")
                 .post(Entity.text(""), String.class);
         res = mapper.readTree(resp);
         assertEquals("milena", res.at("/meta/node").asText());
-
+    
         // Staged data committed
         assertEquals(683, res.at("/messages/0/0").asInt());
     };
@@ -248,8 +248,8 @@
     public void testCollection () throws IOException {
 
         // mate/l:sein
-        String json = getString(getClass().getResource(
-                "/queries/bsp-uid-example.jsonld").getFile());
+        String json = getString(getClass()
+                .getResource("/queries/bsp-uid-example.jsonld").getFile());
 
         try {
             String resp = target.path("/").queryParam("uid", "1")
@@ -259,7 +259,8 @@
             assertEquals(2, res.at("/meta/totalResults").asInt());
         }
         catch (Exception e) {
-            fail("Server response failed: " + e.getMessage() + " (Known issue)");
+            fail("Server response failed: " + e.getMessage()
+                    + " (Known issue)");
         };
 
     };
@@ -268,7 +269,8 @@
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
-            BufferedReader in = new BufferedReader(new FileReader(URLDecoder.decode(path,"UTF-8")));
+            BufferedReader in = new BufferedReader(
+                    new FileReader(URLDecoder.decode(path, "UTF-8")));
             String str;
             while ((str = in.readLine()) != null) {
                 contentBuilder.append(str);