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 0c25081..286e239 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanSegmentQuery.java
@@ -13,71 +13,96 @@
 
 import de.ids_mannheim.korap.query.spans.SegmentSpans;
 
-/** Matching two spans having exactly the same start and end positions.
- * @author margaretha 
+/**
+ * SpanSegmentQuery matches two spans having exactly the same start and end
+ * positions, for instance:
+ * 
+ * <pre>
+ * sq = new SpanSegmentQuery(
+            new SpanTermQuery(new Term("tokens","s:Hund")),
+            new SpanTermQuery(new Term("tokens","tt/p:NN"))
+       );
+ * </pre>
+ * @author margaretha
  * */
-public class SpanSegmentQuery extends SimpleSpanQuery{
-	
-	public SpanSegmentQuery(SpanQuery firstClause, SpanQuery secondClause) {
-		this(firstClause,secondClause,true);
-	}
-	
-	public SpanSegmentQuery(SpanQuery firstClause, SpanQuery secondClause, 
-			boolean collectPayloads) { 
-    	super(firstClause,secondClause,collectPayloads);
-	}
-	
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs, 
-			Map<Term, TermContext> termContexts) throws IOException {
-		return (Spans) new SegmentSpans(this, context, acceptDocs,
-				termContexts);
-	}		
-	
-	@Override
-	public SpanSegmentQuery clone() {
-		SpanSegmentQuery spanSegmentQuery = new SpanSegmentQuery(
-		    (SpanQuery) firstClause.clone(),
-		    (SpanQuery) secondClause.clone(),
-		    collectPayloads
-        );
-		spanSegmentQuery.setBoost(getBoost());
-		return spanSegmentQuery;		
-	}
-	
-    @Override
-	public String toString(String field) {
-		StringBuilder sb = new StringBuilder();
-		sb.append("spanSegment(");
-		sb.append(firstClause.toString(field));
-        sb.append(", ");
-		sb.append(secondClause.toString(field));
-		sb.append(")");
-		sb.append(ToStringUtils.boost(getBoost()));
-		return sb.toString();	
+public class SpanSegmentQuery extends SimpleSpanQuery {
+
+    /**
+     * Creates a SpanSegmentQuery from the two given SpanQueries, by default
+     * payloads are to be collected.
+     * 
+     * @param firstClause a {@link SpanQuery}
+     * @param secondClause a {@link SpanQuery}
+     */
+    public SpanSegmentQuery(SpanQuery firstClause, SpanQuery secondClause) {
+        this(firstClause, secondClause, true);
     }
-	
+
+    /**
+     * @param firstClause a {@link SpanQuery}
+     * @param secondClause a {@link SpanQuery}
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanSegmentQuery(SpanQuery firstClause, SpanQuery secondClause,
+            boolean collectPayloads) {
+        super(firstClause, secondClause, collectPayloads);
+    }
+
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return (Spans) new SegmentSpans(this, context, acceptDocs, termContexts);
+    }
+
+    @Override
+    public SpanSegmentQuery clone() {
+        SpanSegmentQuery spanSegmentQuery = new SpanSegmentQuery(
+                (SpanQuery) firstClause.clone(),
+                (SpanQuery) secondClause.clone(), collectPayloads);
+        spanSegmentQuery.setBoost(getBoost());
+        return spanSegmentQuery;
+    }
+
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("spanSegment(");
+        sb.append(firstClause.toString(field));
+        sb.append(", ");
+        sb.append(secondClause.toString(field));
+        sb.append(")");
+        sb.append(ToStringUtils.boost(getBoost()));
+        return sb.toString();
+    }
+
     @Override
     public boolean equals(Object o) {
-		if (this == o) return true;
-		if (!(o instanceof SpanSegmentQuery)) return false;
-		
-		SpanSegmentQuery spanSegmentQuery = (SpanSegmentQuery) o;
-		
-		if (collectPayloads != spanSegmentQuery.collectPayloads) return false;
-		if (!firstClause.equals(spanSegmentQuery.firstClause)) return false;
-		if (!secondClause.equals(spanSegmentQuery.secondClause)) return false;
-	
-		return getBoost() == spanSegmentQuery.getBoost();
+        if (this == o)
+            return true;
+        if (!(o instanceof SpanSegmentQuery))
+            return false;
+
+        SpanSegmentQuery spanSegmentQuery = (SpanSegmentQuery) o;
+
+        if (collectPayloads != spanSegmentQuery.collectPayloads)
+            return false;
+        if (!firstClause.equals(spanSegmentQuery.firstClause))
+            return false;
+        if (!secondClause.equals(spanSegmentQuery.secondClause))
+            return false;
+
+        return getBoost() == spanSegmentQuery.getBoost();
     };
 
     @Override
     public int hashCode() {
-		int result;
-		result = firstClause.hashCode() + secondClause.hashCode();
-		result ^= (31 * result) + (result >>> 3);
-		result += Float.floatToRawIntBits(getBoost());
-		return result;
+        int result;
+        result = firstClause.hashCode() + secondClause.hashCode();
+        result ^= (31 * result) + (result >>> 3);
+        result += Float.floatToRawIntBits(getBoost());
+        return result;
     };
 
 }
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 a1aed2e..2cba5d9 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanSubspanQuery.java
@@ -12,67 +12,109 @@
 
 import de.ids_mannheim.korap.query.spans.SubSpans;
 
-/**	This query extracts a subspan from a span. The subspan starts from 
- * 	a startOffset until startOffset + length. A positive startOffset 
- * 	is counted from the start of the span, while a negative startOffset 
- * 	is counted from the end of the span. 
+/**
+ * This query extracts a subspan from another span. The subspan starts from a
+ * startOffset until startOffset + length. A positive startOffset is counted
+ * from the start of the span, while a negative startOffset is counted from the
+ * end of the span. <br />
+ * <br />
+ * SpanSubspanQuery takes a SpanQuery as its input and creates subspans from the
+ * resulting spans of the SpanQuery. For instance:
  * 
- * 	@author margaretha
+ * <pre>
+ * SpanTermQuery stq = new SpanTermQuery(new Term("tokens","s:Hund"))
+ * SpanSubspanQuery ssq = new SpanSubspanQuery(stq, 0, 2, true);
+ * </pre>
+ * 
+ * In this example, the SpanSubspanQuery creates subspans "Hu" from all the
+ * occurrences of TermSpans "Hund", that starts from index 0 to 2. It also
+ * collects all payloads from the TermSpans for the SubSpans.
+ * 
+ * @author margaretha
  * */
-public class SpanSubspanQuery extends SimpleSpanQuery{
-	
-	private int startOffset, length;
-			
-	public SpanSubspanQuery(SpanQuery firstClause, int startOffset, int length, 
-			boolean collectPayloads) {
-		super(firstClause, collectPayloads);
-		this.startOffset = startOffset;
-		this.length = length;
-	}
+public class SpanSubspanQuery extends SimpleSpanQuery {
 
-	@Override
-	public SimpleSpanQuery clone() {
-		SpanSubspanQuery sq = new SpanSubspanQuery(
-				this.getFirstClause(), 
-				this.startOffset,
-				this.length, 
-				this.collectPayloads);
-		sq.setBoost(this.getBoost());
-		return sq;
-	}
+    private int startOffset, length;
 
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		return new SubSpans(this, context, acceptDocs, termContexts);
-	}
+    /**
+     * Creates a SpanSubspanQuery (subspan) from the given {@link SpanQuery}
+     * with the specified startOffset and length.
+     * 
+     * @param firstClause a SpanQuery
+     * @param startOffset the start offset of the subspan relative to the
+     *        original span
+     * @param length the length of the subspan
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanSubspanQuery(SpanQuery firstClause, int startOffset, int length,
+            boolean collectPayloads) {
+        super(firstClause, collectPayloads);
+        this.startOffset = startOffset;
+        this.length = length;
+    }
 
-	@Override
-	public String toString(String field) {		
-		StringBuilder sb = new StringBuilder();
-		sb.append("subspan(");
-		sb.append(this.firstClause.toString());
-		sb.append(",");
-		sb.append(this.startOffset);
-		sb.append(",");
-		sb.append(this.length);
-		sb.append(")");
-		return sb.toString();
-	}
+    @Override
+    public SimpleSpanQuery clone() {
+        SpanSubspanQuery sq = new SpanSubspanQuery(this.getFirstClause(),
+                this.startOffset, this.length, this.collectPayloads);
+        sq.setBoost(this.getBoost());
+        return sq;
+    }
 
-	public int getStartOffset() {
-		return startOffset;
-	}
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return new SubSpans(this, context, acceptDocs, termContexts);
+    }
 
-	public void setStartOffset(int startOffset) {
-		this.startOffset = startOffset;
-	}
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("subspan(");
+        sb.append(this.firstClause.toString());
+        sb.append(",");
+        sb.append(this.startOffset);
+        sb.append(",");
+        sb.append(this.length);
+        sb.append(")");
+        return sb.toString();
+    }
 
-	public int getLength() {
-		return length;
-	}
+    /**
+     * Returns the start offset.
+     * 
+     * @return the start offset.
+     */
+    public int getStartOffset() {
+        return startOffset;
+    }
 
-	public void setLength(int length) {
-		this.length = length;
-	}
+    /**
+     * Sets the start offset.
+     * 
+     * @param startOffset the start offset
+     */
+    public void setStartOffset(int startOffset) {
+        this.startOffset = startOffset;
+    }
+
+    /**
+     * Returns the length of the subspan.
+     * 
+     * @return the length of the subspan
+     */
+    public int getLength() {
+        return length;
+    }
+
+    /**
+     * Sets the length of the subspan.
+     * 
+     * @param length the length of the subspan.
+     */
+    public void setLength(int length) {
+        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 114d882..fa70878 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
@@ -10,14 +10,22 @@
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.util.Bits;
 
+import de.ids_mannheim.korap.query.spans.SpansWithId;
 import de.ids_mannheim.korap.query.spans.TermSpansWithId;
 
 /**
- * SpanTermWithIdQuery wraps the normal SpanTermQuery and retrieves TermSpans
- * with a spanid. It is used in other spanqueries requiring spans with id as
- * their child spans, for example span relation with variable query (
+ * SpanTermWithIdQuery wraps a SpanTermQuery retrieving TermSpans and add a
+ * spanid to the TermSpans. It is used in other spanqueries requiring spans with
+ * id as their child spans, for example in span relation with variable query (
  * {@link SpanRelationPartQuery}).
  * 
+ * <pre>
+ * SpanTermWithIdQuery sq = new SpanTermWithIdQuery(new Term("base","tt:p/NN"),true)
+ * </pre>
+ * 
+ * In this example, the SpanTermWithIdQuery retrieves {@link SpansWithId} for
+ * the Term "tt:p/NN".
+ * 
  * @author margaretha
  * */
 public class SpanTermWithIdQuery extends SpanWithIdQuery {
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 d2e8e6f..65335f2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
@@ -20,7 +20,20 @@
 /**
  * Enumeration of spans (e.g. element or relation spans) having some specific
  * attribute(s) or <em>not</em> having some attribute(s). It is necessary that
- * the spans have ids to be able to identify to which span an attribute belongs.
+ * the spans have ids to be able to identify to which span an attribute belongs. <br />
+ * <br />
+ * 
+ * In the example below, the SpanWithAttributeQuery retrieves
+ * <code>&lt;div&gt;</code> elements having attributes
+ * <code>@:class=header</code>.
+ * 
+ * <pre>
+ * SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(new Term(
+ *         &quot;tokens&quot;, &quot;@:class=header&quot;)), true);
+ * SpanWithAttributeQuery sq = new SpanWithAttributeQuery(new SpanElementQuery(
+ *         &quot;tokens&quot;, &quot;div&quot;), saq, true);
+ * </pre>
+ * 
  * 
  * @author margaretha
  */
@@ -68,7 +81,9 @@
         return type;
     }
 
-    /** Sets the type of the query based of the class of the firstClause / first span.
+    /**
+     * Sets the type of the query based of the class of the firstClause / first
+     * span.
      * 
      */
     public void setType() {
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 7ebbc46..182942a 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
@@ -15,144 +15,173 @@
 
 import de.ids_mannheim.korap.query.SpanNextQuery;
 
-/**	NextSpans is an enumeration of Span matches, which ensures that  
- * 	a span is immediately followed by another span.
- *  
- *  Update: allow multiple matches at the same firstspan position
- *  
- * 	@author margaretha, diewald
+/**
+ * NextSpans is an enumeration of Span matches, which ensures that a span is
+ * immediately followed by another span.
+ * 
+ * The implementation allows multiple matches at the same firstspan position.
+ * 
+ * @author margaretha, diewald
  * */
-public class NextSpans extends SimpleSpans {	
-	
-	private List<CandidateSpan> matchList;
-	private List<CandidateSpan> candidateList;
-	private int candidateListDocNum;
-	private boolean hasMoreFirstSpan;
-	
-	private Logger log = LoggerFactory.getLogger(NextSpans.class);
+public class NextSpans extends SimpleSpans {
 
-    // This advices the java compiler to ignore all loggings
-    public static final boolean DEBUG = false;
+    private List<CandidateSpan> matchList;
+    private List<CandidateSpan> candidateList;
+    private int candidateListDocNum;
+    private boolean hasMoreFirstSpan;
 
-	
-    public NextSpans (SpanNextQuery spanNextQuery,
-		      AtomicReaderContext context,
-		      Bits acceptDocs,
-		      Map<Term,TermContext> termContexts) throws IOException {
-    	super(spanNextQuery, context, acceptDocs, termContexts);
-    	collectPayloads = spanNextQuery.isCollectPayloads();
-    	hasMoreSpans =  secondSpans.next();
-    	matchList = new ArrayList<>();
-		candidateList = new ArrayList<>();
+    private Logger log = LoggerFactory.getLogger(NextSpans.class);
+
+    /**
+     * Constructs NextSpans for the given {@link SpanNextQuery}.
+     * 
+     * @param spanNextQuery
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public NextSpans(SpanNextQuery spanNextQuery, AtomicReaderContext context,
+            Bits acceptDocs, Map<Term, TermContext> termContexts)
+            throws IOException {
+        super(spanNextQuery, context, acceptDocs, termContexts);
+        collectPayloads = spanNextQuery.isCollectPayloads();
+        hasMoreSpans = secondSpans.next();
+        matchList = new ArrayList<>();
+        candidateList = new ArrayList<>();
     }
 
-	@Override
-	public boolean next() throws IOException {		
-		isStartEnumeration=false;
-  		matchPayload.clear();
-  		return advance();  		
-	}
-	
-	private boolean advance() throws IOException {
-		
-		while (hasMoreSpans || !matchList.isEmpty() || !candidateList.isEmpty()){			
-			if (!matchList.isEmpty()){
-				matchDocNumber = firstSpans.doc();
-			    matchStartPosition = firstSpans.start();
-			    matchEndPosition = matchList.get(0).getEnd();
-			    if (collectPayloads)
-			    	matchPayload.addAll( matchList.get(0).getPayloads() );	
-			    //System.out.println(this.toString());
-				/*System.out.println("Match positions "+ matchStartPosition+","+
-				  matchEndPosition);*/
-			    matchList.remove(0);
-			    return true;
-			}
-			// Forward firstspan
-			hasMoreFirstSpan = firstSpans.next();
-			if (hasMoreFirstSpan) setMatchList();
-			else {
-				hasMoreSpans = false;
-				candidateList.clear(); }
-		}		
-		return false;
-	}
+    @Override
+    public boolean next() throws IOException {
+        isStartEnumeration = false;
+        matchPayload.clear();
+        return advance();
+    }
 
-	private void setMatchList() throws IOException {
-		if (firstSpans.doc() == candidateListDocNum){			
-			searchCandidates();
-			searchMatches();
-		}
-		else{ 
-			candidateList.clear();
-			if (hasMoreSpans && ensureSameDoc(firstSpans,secondSpans)){
-				candidateListDocNum = firstSpans.doc();
-				searchMatches();				
-			}
-		}		
-	}
-	
-	private void searchCandidates() throws IOException {
-		Iterator<CandidateSpan> i = candidateList.iterator();
-		CandidateSpan cs;
-		while(i.hasNext()){
-			cs = i.next();
-			if (cs.getStart() == firstSpans.end()){
-				addMatch(cs);
-			}
-			else{
-				//System.out.println(cs.getStart() + " " +firstSpans.end());
-				i.remove();
-			}
-		}	
-	}
+    /**
+     * Advances the NextSpans to the next match by checking the matchList or
+     * setting the matchlist first, if it is empty.
+     * 
+     * @return <code>true</code> if a match is found, <code>false</code>
+     *         otherwise.
+     * @throws IOException
+     */
+    private boolean advance() throws IOException {
 
+        while (hasMoreSpans || !matchList.isEmpty() || !candidateList.isEmpty()) {
+            if (!matchList.isEmpty()) {
+                matchDocNumber = firstSpans.doc();
+                matchStartPosition = firstSpans.start();
+                matchEndPosition = matchList.get(0).getEnd();
+                if (collectPayloads)
+                    matchPayload.addAll(matchList.get(0).getPayloads());
+                //System.out.println(this.toString());
+                /*
+                 * System.out.println("Match positions "+
+                 * matchStartPosition+","+ matchEndPosition);
+                 */
+                matchList.remove(0);
+                return true;
+            }
+            // Forward firstspan
+            hasMoreFirstSpan = firstSpans.next();
+            if (hasMoreFirstSpan)
+                setMatchList();
+            else {
+                hasMoreSpans = false;
+                candidateList.clear();
+            }
+        }
+        return false;
+    }
 
-	private void searchMatches() throws IOException {
-		
-		while (hasMoreSpans && candidateListDocNum == secondSpans.doc()){
-			if (secondSpans.start() > firstSpans.end()){
-				break;
-			}
-			if (secondSpans.start() == firstSpans.end()){
-				candidateList.add(new CandidateSpan(secondSpans));
-				addMatch(new CandidateSpan(secondSpans));
-			}
-			hasMoreSpans = secondSpans.next();
-		}
-	}
-	
-	private void addMatch(CandidateSpan cs) throws IOException{
-		
-		int start = firstSpans.start();
-		long cost = firstSpans.cost() + cs.getCost();
-		
-		List<byte[]> payloads = new ArrayList<byte[]>();
-		if (collectPayloads) {
-			if (firstSpans.isPayloadAvailable())
-				payloads.addAll(firstSpans.getPayload());
-			if (cs.getPayloads() != null)
-				payloads.addAll(cs.getPayloads());
-		}	
-		
-		matchList.add(new CandidateSpan(start,cs.getEnd(),candidateListDocNum,cost,
-				payloads));
-	}
+    /**
+     * Sets the matchlist by first searching the candidates and then find all
+     * the matches.
+     * 
+     * @throws IOException
+     */
+    private void setMatchList() throws IOException {
+        if (firstSpans.doc() == candidateListDocNum) {
+            searchCandidates();
+            searchMatches();
+        } else {
+            candidateList.clear();
+            if (hasMoreSpans && ensureSameDoc(firstSpans, secondSpans)) {
+                candidateListDocNum = firstSpans.doc();
+                searchMatches();
+            }
+        }
+    }
 
-	@Override
-	public boolean skipTo(int target) throws IOException {
-		if (hasMoreSpans && (firstSpans.doc() < target)){
-  			if (!firstSpans.skipTo(target)){
-  				hasMoreSpans = false;
-  				return false;
-  			}			
-  		} 		
-  		matchPayload.clear();
-  		return advance();
-	}
+    /**
+     * Finds all candidates whose start position is the same as the firstspan's
+     * end position.
+     * 
+     * @throws IOException
+     */
+    private void searchCandidates() throws IOException {
+        Iterator<CandidateSpan> i = candidateList.iterator();
+        CandidateSpan cs;
+        while (i.hasNext()) {
+            cs = i.next();
+            if (cs.getStart() == firstSpans.end()) {
+                addMatch(cs);
+            } else {
+                //System.out.println(cs.getStart() + " " +firstSpans.end());
+                i.remove();
+            }
+        }
+    }
 
-	@Override
-	public long cost() {
-		return firstSpans.cost() + secondSpans.cost();
-	}
+    /**
+     * @throws IOException
+     */
+    private void searchMatches() throws IOException {
+
+        while (hasMoreSpans && candidateListDocNum == secondSpans.doc()) {
+            if (secondSpans.start() > firstSpans.end()) {
+                break;
+            }
+            if (secondSpans.start() == firstSpans.end()) {
+                candidateList.add(new CandidateSpan(secondSpans));
+                addMatch(new CandidateSpan(secondSpans));
+            }
+            hasMoreSpans = secondSpans.next();
+        }
+    }
+
+    private void addMatch(CandidateSpan cs) throws IOException {
+
+        int start = firstSpans.start();
+        long cost = firstSpans.cost() + cs.getCost();
+
+        List<byte[]> payloads = new ArrayList<byte[]>();
+        if (collectPayloads) {
+            if (firstSpans.isPayloadAvailable())
+                payloads.addAll(firstSpans.getPayload());
+            if (cs.getPayloads() != null)
+                payloads.addAll(cs.getPayloads());
+        }
+
+        matchList.add(new CandidateSpan(start, cs.getEnd(),
+                candidateListDocNum, cost, payloads));
+    }
+
+    @Override
+    public boolean skipTo(int target) throws IOException {
+        if (hasMoreSpans && (firstSpans.doc() < target)) {
+            if (!firstSpans.skipTo(target)) {
+                hasMoreSpans = false;
+                return false;
+            }
+        }
+        matchPayload.clear();
+        return advance();
+    }
+
+    @Override
+    public long cost() {
+        return firstSpans.cost() + secondSpans.cost();
+    }
 };
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 4692da0..8e56ca7 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
@@ -13,96 +13,114 @@
 
 import de.ids_mannheim.korap.query.SimpleSpanQuery;
 
-/** An abstract class for Span enumeration whose two child spans are matched by 
- * 	their positions and do not have a partial overlap.
- *  
- * 	@author margaretha  
+/**
+ * An abstract class for Span enumeration whose two child spans are matched by
+ * their positions and do not have a partial overlap.
+ * 
+ * @author margaretha
  * */
-public abstract class NonPartialOverlappingSpans extends SimpleSpans{
-	
-	private Logger log = LoggerFactory.getLogger(NonPartialOverlappingSpans.class);
+public abstract class NonPartialOverlappingSpans extends SimpleSpans {
 
-  	public NonPartialOverlappingSpans(SimpleSpanQuery simpleSpanQuery,
-			AtomicReaderContext context, Bits acceptDocs,
-			Map<Term,TermContext> termContexts) throws IOException {	    	  
-		super(simpleSpanQuery, context, acceptDocs, termContexts);
-		
-		// Warning: not implemented, results in errors for SpanNextQuery 
-		// This.collectPayloads = simpleSpanQuery.isCollectPayloads()
-		collectPayloads = true;
-		hasMoreSpans = secondSpans.next();		
-		
-	}
-	
+    private Logger log = LoggerFactory
+            .getLogger(NonPartialOverlappingSpans.class);
+
+    /**
+     * Constructs NonPartialOverlappingSpans from the given
+     * {@link SimpleSpanQuery}.
+     * 
+     * @param simpleSpanQuery a SimpleSpanQuery
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public NonPartialOverlappingSpans(SimpleSpanQuery simpleSpanQuery,
+            AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        super(simpleSpanQuery, context, acceptDocs, termContexts);
+
+        // Warning: not implemented, results in errors for SpanNextQuery 
+        // This.collectPayloads = simpleSpanQuery.isCollectPayloads()
+        collectPayloads = true;
+        hasMoreSpans = secondSpans.next();
+
+    }
+
     @Override
-  	public boolean next() throws IOException {
-    	// Warning: this does not work for overlapping spans 
-    	// e.g. get multiple second spans in a firstspan
-  		hasMoreSpans &= firstSpans.next();
-  		isStartEnumeration=false;
-  		matchPayload.clear();
-  		return advance();  		
-  	}
-  	
-	/** Advance is a lucene terminology to search for the next match.
-	 * */
-    protected boolean advance() throws IOException {	    	
-		// The complexity is linear for searching in a document. 
-		// It's better if we can skip to >= position in a document.
-	  	while (hasMoreSpans && ensureSameDoc(firstSpans,secondSpans)){
-	  		int matchCase = findMatch();
-				if (matchCase == 0){
-					//log.trace("Match doc#: {}",matchDocNumber);
-					//log.trace("Match positions: {}-{}", matchStartPosition,matchEndPosition);
-					doCollectPayloads();
-					return true;
-				} 
-				else if (matchCase == 1) {
-					hasMoreSpans = secondSpans.next();			
-				}			
-				else{ 
-					hasMoreSpans = firstSpans.next();
-				}
-			}
-		return false;
-	}
-    
-    /** Specify the condition for a match 
-     * @return 0 iff match is found,
-     * 			-1 to advance the firstspan,		
-     * 			1 to advance the secondspan
+    public boolean next() throws IOException {
+        // Warning: this does not work for overlapping spans 
+        // e.g. get multiple second spans in a firstspan
+        hasMoreSpans &= firstSpans.next();
+        isStartEnumeration = false;
+        matchPayload.clear();
+        return advance();
+    }
+
+    /**
+     * Advances to the next match.
+     * 
+     * @return <code>true</code> if a match is found, <code>false</code>
+     *         otherwise.
+     * @throws IOException
+     */
+    protected boolean advance() throws IOException {
+        // The complexity is linear for searching in a document. 
+        // It's better if we can skip to >= position in a document.
+        while (hasMoreSpans && ensureSameDoc(firstSpans, secondSpans)) {
+            int matchCase = findMatch();
+            if (matchCase == 0) {
+                doCollectPayloads();
+                return true;
+            } else if (matchCase == 1) {
+                hasMoreSpans = secondSpans.next();
+            } else {
+                hasMoreSpans = firstSpans.next();
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Specifies the condition for a match.
+     * 
+     * @return 0 iff match is found, -1 to advance the firstspan, 1 to advance
+     *         the secondspan
      * */
-  	protected abstract int findMatch();
-    
-  	/** Collecting available payloads from the current first and second spans */
-  	private void doCollectPayloads() throws IOException {
-  		Collection<byte[]> payload;
-  		if (collectPayloads){
-  		    if (firstSpans.isPayloadAvailable()) {
-  		    	 payload = firstSpans.getPayload();
-  		    	matchPayload.addAll(payload);
-  		    }
-  		    if (secondSpans.isPayloadAvailable()) {
-  		    	payload = secondSpans.getPayload();
-  		    	matchPayload.addAll(payload);
-  		    }
-  		}
-  	}
-    
-  	@Override
-  	public boolean skipTo(int target) throws IOException {		
-  		if (hasMoreSpans && (firstSpans.doc() < target)){
-  			if (!firstSpans.skipTo(target)){
-  				hasMoreSpans = false;
-  				return false;
-  			}			
-  		} 		
-  		matchPayload.clear();
-  		return advance();
-  	}
-  	
-  	@Override
-  	public long cost() {
-  		return firstSpans.cost() + secondSpans.cost();
-  	}
+    protected abstract int findMatch();
+
+    /**
+     * Collects available payloads from the current first and second spans.
+     * 
+     * @throws IOException
+     */
+    private void doCollectPayloads() throws IOException {
+        Collection<byte[]> payload;
+        if (collectPayloads) {
+            if (firstSpans.isPayloadAvailable()) {
+                payload = firstSpans.getPayload();
+                matchPayload.addAll(payload);
+            }
+            if (secondSpans.isPayloadAvailable()) {
+                payload = secondSpans.getPayload();
+                matchPayload.addAll(payload);
+            }
+        }
+    }
+
+    @Override
+    public boolean skipTo(int target) throws IOException {
+        if (hasMoreSpans && (firstSpans.doc() < target)) {
+            if (!firstSpans.skipTo(target)) {
+                hasMoreSpans = false;
+                return false;
+            }
+        }
+        matchPayload.clear();
+        return advance();
+    }
+
+    @Override
+    public long cost() {
+        return firstSpans.cost() + secondSpans.cost();
+    }
 }
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 52185e8..761fa95 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
@@ -27,7 +27,7 @@
     protected int candidateListDocNum;
 
     /**
-     * Constructs an OrderedDistanceSpans based on the given SpanDistanceQuery.
+     * Constructs OrderedDistanceSpans based on the given SpanDistanceQuery.
      * 
      * @param query a SpanDistanceQuery
      * @param context
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationBaseSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationBaseSpans.java
index 914bf7f..a6b1635 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationBaseSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationBaseSpans.java
@@ -27,7 +27,7 @@
     protected int rightStart, rightEnd;
 
     /**
-     * Create a RelationBaseSpans based on the given SpanWithIdQuery.
+     * Constructs RelationBaseSpans based on the given SpanWithIdQuery.
      * 
      * @param spanWithIdQuery a SpanWithIdQuery, for instance a
      *        {@link SpanElementQuery} or {@link SpanRelationQuery}.
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
index 98ccf18..04af3e5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
@@ -37,7 +37,7 @@
     private int window; // number of tokens as the window
 
     /**
-     * Creates a RelationPartSpans from the specified
+     * Constructs RelationPartSpans from the specified
      * {@link SpanRelationPartQuery}.
      * 
      * @param query a SpanRelationPartQuery
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 05de6d5..abb8fda 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
@@ -54,7 +54,7 @@
     private List<CandidateRelationSpan> candidateList;
 
     /**
-     * Creates a RelationSpans from the given {@link SpanRelationQuery}.
+     * Constructs RelationSpans from the given {@link SpanRelationQuery}.
      * 
      * @param relationSpanQuery a SpanRelationQuery
      * @param context
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 d4a0e58..432862f 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
@@ -10,37 +10,46 @@
 
 import de.ids_mannheim.korap.query.SpanSegmentQuery;
 
-/**	SegmentSpans is an enumeration of Span matches, which ensures that two spans 
- * 	have exactly the same start and end positions. It also represents the span 
- * 	match object. This is not very neat, but that is the Lucene's design.
+/**
+ * SegmentSpans is an enumeration of Span matches in which that two child spans
+ * have exactly the same start and end positions.
  * 
- * 	@author margaretha 
+ * @author margaretha
  * */
-public class SegmentSpans extends NonPartialOverlappingSpans {	
-	
-    public SegmentSpans (SpanSegmentQuery spanSegmentQuery,
-  	      AtomicReaderContext context,
-  	      Bits acceptDocs,
-  	      Map<Term,TermContext> termContexts) throws IOException {
-    	super(spanSegmentQuery, context, acceptDocs, termContexts);    	
+public class SegmentSpans extends NonPartialOverlappingSpans {
+
+    /**
+     * Creates SegmentSpans from the given {@link SpanSegmentQuery}.
+     * 
+     * @param spanSegmentQuery a spanSegmentQuery.
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public SegmentSpans(SpanSegmentQuery spanSegmentQuery,
+            AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        super(spanSegmentQuery, context, acceptDocs, termContexts);
     }
 
-    /** Check weather the start and end positions of the current 
-     * 	firstspan and secondspan are identical. 
-  	 * */
+    /**
+     * Check weather the start and end positions of the current firstspan and
+     * secondspan are identical.
+     * 
+     * */
     @Override
-	protected int findMatch() {
-		if (firstSpans.start() == secondSpans.start() &&
-			firstSpans.end() == secondSpans.end() ){
-			matchDocNumber = firstSpans.doc();
-			matchStartPosition = firstSpans.start();
-			matchEndPosition = firstSpans.end();			
-			return 0;
-		}
-		else if (firstSpans.start() < secondSpans.start() || 
-				firstSpans.end() < secondSpans.end())
-			return -1;
-		
-		return 1;
-	}	
+    protected int findMatch() {
+        if (firstSpans.start() == secondSpans.start()
+                && firstSpans.end() == secondSpans.end()) {
+            matchDocNumber = firstSpans.doc();
+            matchStartPosition = firstSpans.start();
+            matchEndPosition = firstSpans.end();
+            return 0;
+        } else if (firstSpans.start() < secondSpans.start()
+                || firstSpans.end() < secondSpans.end())
+            return -1;
+
+        return 1;
+    }
 }
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 a9723e8..0362bfa 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
@@ -36,7 +36,7 @@
     protected Logger logger = LoggerFactory.getLogger(SpansWithAttribute.class);
 
     /**
-     * Creates a SpansWithAttribute from the given
+     * Constructs SpansWithAttribute from the given
      * {@link SpanWithAttributeQuery} and {@link SpansWithId}, such as
      * elementSpans and relationSpans.
      * 
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 0d984cd..c691a46 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
@@ -10,59 +10,89 @@
 
 import de.ids_mannheim.korap.query.SpanSubspanQuery;
 
-public class SubSpans extends SimpleSpans{
+/**
+ * Enumeration of SubSpans, which are parts of another Spans. The SubSpans are
+ * specified with a start offset relative to the original span and a length.
+ * 
+ * @author margaretha
+ * 
+ */
+public class SubSpans extends SimpleSpans {
 
-	private int startOffset, length;
-	
-	public SubSpans(SpanSubspanQuery subspanQuery,
-			AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		super(subspanQuery, context, acceptDocs, termContexts);
-		this.startOffset= subspanQuery.getStartOffset();
-		this.length = subspanQuery.getLength();
-		hasMoreSpans = firstSpans.next();
-	}
+    private int startOffset, length;
 
-	@Override
-	public boolean next() throws IOException {
-		isStartEnumeration=false;		
-		return advance();
-	}
+    /**
+     * Constructs SubSpans for the given {@link SpanSubspanQuery} specifiying
+     * the start offset and the length of the subspans.
+     * 
+     * @param subspanQuery a SpanSubspanQuery
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public SubSpans(SpanSubspanQuery subspanQuery, AtomicReaderContext context,
+            Bits acceptDocs, Map<Term, TermContext> termContexts)
+            throws IOException {
+        super(subspanQuery, context, acceptDocs, termContexts);
+        this.startOffset = subspanQuery.getStartOffset();
+        this.length = subspanQuery.getLength();
+        hasMoreSpans = firstSpans.next();
+    }
 
-	private boolean advance() throws IOException {
-		while (hasMoreSpans){
-			setMatch();
-			hasMoreSpans = firstSpans.next();
-			return true;
-		}
-		return false;
-	}
-	
-	public void setMatch() throws IOException {
-		if (this.startOffset < 0)
-			matchStartPosition = firstSpans.end() + startOffset;
-		else matchStartPosition = firstSpans.start() + startOffset;
-		
-		matchEndPosition = matchStartPosition + this.length;
-		matchPayload = firstSpans.getPayload();
-		matchDocNumber = firstSpans.doc();
-	}
-	
-	@Override
-	public boolean skipTo(int target) throws IOException {
-		if (hasMoreSpans && (firstSpans.doc() < target)){
-  			if (!firstSpans.skipTo(target)){
-  				hasMoreSpans = false;
-  				return false;
-  			}
-  		} 		
-  		matchPayload.clear();
-  		return advance();
-	}
+    @Override
+    public boolean next() throws IOException {
+        isStartEnumeration = false;
+        return advance();
+    }
 
-	@Override
-	public long cost() {		
-		return firstSpans.cost() + 1;
-	}
+    /**
+     * Advances the SubSpans to the next match.
+     * 
+     * @return <code>true</code> if a match is found, <code>false</code>
+     *         otherwise.
+     * @throws IOException
+     */
+    private boolean advance() throws IOException {
+        while (hasMoreSpans) {
+            setMatch();
+            hasMoreSpans = firstSpans.next();
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Sets the properties of the current match/subspan.
+     * 
+     * @throws IOException
+     */
+    public void setMatch() throws IOException {
+        if (this.startOffset < 0)
+            matchStartPosition = firstSpans.end() + startOffset;
+        else
+            matchStartPosition = firstSpans.start() + startOffset;
+
+        matchEndPosition = matchStartPosition + this.length;
+        matchPayload = firstSpans.getPayload();
+        matchDocNumber = firstSpans.doc();
+    }
+
+    @Override
+    public boolean skipTo(int target) throws IOException {
+        if (hasMoreSpans && (firstSpans.doc() < target)) {
+            if (!firstSpans.skipTo(target)) {
+                hasMoreSpans = false;
+                return false;
+            }
+        }
+        matchPayload.clear();
+        return advance();
+    }
+
+    @Override
+    public long cost() {
+        return firstSpans.cost() + 1;
+    }
 
 }
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 150c61e..fcfab27 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
@@ -22,7 +22,7 @@
 public class TokenDistanceSpans extends OrderedDistanceSpans {
 
     /**
-     * Constructs a TokenDistanceSpans from the given query.
+     * Constructs TokenDistanceSpans from the given query.
      * 
      * @param query a SpanDistanceQuery
      * @param context
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 8f68c8d..0d29645 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
@@ -33,8 +33,8 @@
     protected int currentDocNum;
 
     /**
-     * Constructs an UnorderedDistanceSpans for the given
-     * {@link SpanDistanceQuery}.
+     * Constructs UnorderedDistanceSpans for the given {@link SpanDistanceQuery}
+     * .
      * 
      * @param query a SpanDistanceQuery
      * @param context
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 102b5c9..f0df28e 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
@@ -34,7 +34,7 @@
     private List<CandidateSpan> elementList;
 
     /**
-     * Constructs an UnorderedElementDistanceSpans for the given
+     * Constructs UnorderedElementDistanceSpans for the given
      * {@link SpanDistanceQuery}.
      * 
      * @param query a SpanDistanceQuery
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 bc9f0e5..c5061d3 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
@@ -23,8 +23,7 @@
 public class UnorderedTokenDistanceSpans extends UnorderedDistanceSpans {
 
     /**
-     * Constructs an UnorderedTokenDistanceSpans for the given
-     * SpanDistanceQuery.
+     * Constructs UnorderedTokenDistanceSpans for the given SpanDistanceQuery.
      * 
      * @param query a SpanDistanceQuery
      * @param context
