diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanElementQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanElementQuery.java
index cbbab44..28df548 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanElementQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanElementQuery.java
@@ -9,94 +9,132 @@
 import org.apache.lucene.index.TermContext;
 import org.apache.lucene.search.spans.SpanTermQuery;
 import org.apache.lucene.search.spans.Spans;
+import org.apache.lucene.search.spans.TermSpans;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ToStringUtils;
 
 import de.ids_mannheim.korap.query.spans.ElementSpans;
 
-/** 
- * 	@author Nils Diewald, Margaretha
+/**
+ * SpanElementQuery retrieves {@link ElementSpans} which are special
+ * {@link Term Terms} with prefix "<>". Unlike {@link TermSpans} consisting of
+ * only one term, ElementSpans may contains more than one term comprising a
+ * phrase, a clause, a sentence and so on. <br/>
+ * <br/>
+ * Examples of {@link ElementSpans} are
+ * 
+ * <ul>
+ * <li>sentences indexed as <>:s
+ * 
+ * <pre>
+ * SpanElementQuery seq = new SpanElementQuery(&quot;tokens&quot;, &quot;s&quot;);
+ * </pre>
+ * 
+ * </li>
+ * <li>paragraphs indexed as <>:p
+ * 
+ * <pre>
+ * SpanElementQuery seq = new SpanElementQuery(&quot;tokens&quot;, &quot;p&quot;);
+ * </pre>
+ * 
+ * </li>
+ * 
+ * </ul>
+ * 
+ * @author Nils Diewald
+ * @author margaretha
  */
-
-/** Matches spans wrapped by an element. */
 public class SpanElementQuery extends SpanWithIdQuery {
-	//private SpanTermQuery termQuery;
+    // private SpanTermQuery termQuery;
     private static Term elementTerm;
     private String elementStr;
-    
-    /** Constructor. */
-    public SpanElementQuery (String field, String term) {   
-    	super(new SpanTermQuery(
-    			(elementTerm = new Term(field,"<>:"+term))
-    			),
-    		true
-		);
-    	this.elementStr = term;    	
-    	//this.termQuery = (SpanTermQuery) this.getFirstClause();
-    	//this.elementTerm = termQuery.getTerm();
+
+    /**
+     * Constructs a SpanElementQuery for the given term in the given field.
+     * 
+     * @param field a field where a term belongs to
+     * @param term a term
+     */
+    public SpanElementQuery(String field, String term) {
+        super(new SpanTermQuery((elementTerm = new Term(field, "<>:" + term))),
+                true);
+        this.elementStr = term;
+        // this.termQuery = (SpanTermQuery) this.getFirstClause();
+        // this.elementTerm = termQuery.getTerm();
     };
 
     @Override
-    public Spans getSpans(final AtomicReaderContext context,
-			  Bits acceptDocs,
-			  Map<Term,TermContext> termContexts) throws IOException {
-    	return new ElementSpans(this, context, acceptDocs, termContexts);
+    public Spans getSpans(final AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return new ElementSpans(this, context, acceptDocs, termContexts);
     };
 
-	public String getElementStr () {
-		return elementStr;
+    /**
+     * Returns the element name or string, for instance "s" for sentence
+     * elements.
+     * 
+     * @return the element name/string.
+     */
+    public String getElementStr() {
+        return elementStr;
     };
 
-    public void setElementStr (String elementStr) {
-    	this.elementStr = elementStr;
+    /**
+     * Sets the element name or string, for instance "s" for sentence elements.
+     * 
+     * @param elementStr the element name or string
+     */
+    public void setElementStr(String elementStr) {
+        this.elementStr = elementStr;
     }
 
-	@Override
-	public SimpleSpanQuery clone() {
-		SpanElementQuery sq = new SpanElementQuery(
-				this.getField(), 
-				this.getElementStr()
-		);
-		sq.setBoost(this.getBoost());
-		return sq;
-	};
-	
+    @Override
+    public SimpleSpanQuery clone() {
+        SpanElementQuery sq = new SpanElementQuery(this.getField(),
+                this.getElementStr());
+        sq.setBoost(this.getBoost());
+        return sq;
+    };
+
     @Override
     public void extractTerms(Set<Term> terms) {
-    	terms.add(elementTerm);
+        terms.add(elementTerm);
     };
 
     @Override
     public String toString(String field) {
-    	StringBuilder buffer = new StringBuilder("<");
-    	buffer.append(getField()).append(':').append(elementStr);
-    	buffer.append(ToStringUtils.boost(getBoost()));
-    	return buffer.append(" />").toString();
+        StringBuilder buffer = new StringBuilder("<");
+        buffer.append(getField()).append(':').append(elementStr);
+        buffer.append(ToStringUtils.boost(getBoost()));
+        return buffer.append(" />").toString();
     };
-    
+
     @Override
     public int hashCode() {
-    	final int prime = 37; // Instead of 31
-    	int result = super.hashCode();
-    	result = prime * result + ((elementStr == null) ? 0 : elementStr.hashCode());
-    	return result;
+        final int prime = 37; // Instead of 31
+        int result = super.hashCode();
+        result = prime * result
+                + ((elementStr == null) ? 0 : elementStr.hashCode());
+        return result;
     };
 
     @Override
     public boolean equals(Object obj) {
-		if (this == obj) return true;
-		//if (!super.equals(obj)) return false;
-		if (getClass() != obj.getClass()) return false;
-		
-		SpanElementQuery other = (SpanElementQuery) obj;
-		if (elementStr == null && other.elementStr != null)
-			return false;
-		else if (!elementStr.equals(other.elementStr))
-		    return false;
-		
-		if (!getField().equals(other.getField()))
-		    return false;
-		return true;
+        if (this == obj)
+            return true;
+        // if (!super.equals(obj)) return false;
+        if (getClass() != obj.getClass())
+            return false;
+
+        SpanElementQuery other = (SpanElementQuery) obj;
+        if (elementStr == null && other.elementStr != null)
+            return false;
+        else if (!elementStr.equals(other.elementStr))
+            return false;
+
+        if (!getField().equals(other.getField()))
+            return false;
+        return true;
     };
- 
+
 };
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
index 97f1de0..6989a81 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
@@ -12,123 +12,217 @@
 
 import de.ids_mannheim.korap.query.spans.RelationPartSpans;
 
-/** This query match one part of a relation (either left or right) to certain 
- * 	elements or terms, and return the other part of the relation.	
+/**
+ * This query match a part of a relation (either left or right) to certain
+ * elements or terms. If inversed, the start and end positions of the right part
+ * of the relation are set as positions of the match.
  * 
- * 	@author margaretha
+ * @author margaretha
  * */
-public class SpanRelationPartQuery extends SpanRelationQuery{
-	
-	private static String elementStr = "s"; // default element interval type
-	
-	private SpanElementQuery elementQuery;
-	private boolean matchRight;  // if false, match left
-	private boolean inverseRelation;  // if false, sort result by the left
-	private int window;	
-	
-	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
-			SpanWithIdQuery secondClause, // match tokenWithIdQuery, ElementQuery, RelationQuery
-			boolean matchRight,
-			boolean inverseRelation,
-			boolean collectPayloads) {
-		this(spanRelationQuery, secondClause, elementStr, matchRight, inverseRelation, collectPayloads);		
-	}
-	
-	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
-			SpanWithIdQuery secondClause, 
-			String elementStr,
-			boolean matchRight,
-			boolean inverseRelation,
-			boolean collectPayloads) {
-		super(spanRelationQuery, secondClause, collectPayloads);
-		this.matchRight = matchRight;
-		this.inverseRelation = inverseRelation;
-		elementQuery = new SpanElementQuery(spanRelationQuery.getField(), elementStr);		
-	}
-	
-	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
-			SpanWithIdQuery secondClause, // match tokenWithIdQuery, ElementQuery, RelationQuery
-			int window,
-			boolean matchRight,
-			boolean inverseRelation,
-			boolean collectPayloads) {
-		super(spanRelationQuery, secondClause, collectPayloads);
-		this.matchRight = matchRight;
-		this.inverseRelation = inverseRelation;
-		this.window = window;
-	}
-	
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-			return new RelationPartSpans(this, context, acceptDocs, termContexts);
-	}
-	
-	@Override
-	public SimpleSpanQuery clone() {
-		SpanRelationPartQuery sq = new SpanRelationPartQuery(
-				(SpanRelationQuery) this.firstClause, 
-				(SpanWithIdQuery) this.secondClause,
-				this.elementQuery.getElementStr(),
-				this.matchRight, 
-				this.inverseRelation,
-				this.collectPayloads
-		);		
-		return sq;
-	}
+public class SpanRelationPartQuery extends SpanRelationQuery {
 
-	@Override
-	public String toString(String field) {
-		StringBuilder sb = new StringBuilder();		
-		sb.append("spanRelationWithVariable(");
-		sb.append(firstClause.toString(field));
-		sb.append(",");
-		sb.append(secondClause.toString(field));
-		sb.append(",");
-		sb.append( matchRight ? "matchRight, " : "matchLeft, " );
-		sb.append(",");
-		if (elementQuery != null){
-			sb.append("element:");
-			sb.append(elementQuery.getElementStr());
-		}
-		else {
-			sb.append("window:");
-			sb.append(this.window);
-		}
-		sb.append(")");
-		sb.append(ToStringUtils.boost(getBoost()));
-		return sb.toString();
-	}
+    private static String elementStr = "s"; // default element interval type
 
-	public boolean isMatchRight() {
-		return matchRight;
-	}
+    private SpanElementQuery elementQuery;
+    private boolean matchRight; // if false, match left
+    private boolean inverseRelation; // if false, sort result by the left
+    private int window;
 
-	public void setMatchRight(boolean matchRight) {
-		this.matchRight = matchRight;
-	}
+    /**
+     * Constructs a SpanRelationPartQuery based on the specified
+     * {@link SpanRelationQuery} and {@link SpanWithIdQuery} within a sentence.
+     * 
+     * @param spanRelationQuery a SpanRelationQuery
+     * @param secondClause a SpanWithIdQuery
+     * @param matchRight <code>true</code> if the right side have to be matched
+     *        with the specified SpanWithIdQuery, <code>false</code> otherwise.
+     * @param inverseRelation <code>true</code> if the resulting
+     *        {@link RelationPartSpans} is to be ordered by right side
+     *        positions, <code>false</code> otherwise.
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
+            SpanWithIdQuery secondClause, // match tokenWithIdQuery, ElementQuery, RelationQuery
+            boolean matchRight, boolean inverseRelation, boolean collectPayloads) {
+        this(spanRelationQuery, secondClause, elementStr, matchRight,
+                inverseRelation, collectPayloads);
+    }
 
-	public boolean isInverseRelation() {
-		return inverseRelation;
-	}
+    /**
+     * Constructs a SpanRelationPartQuery based on the specified
+     * {@link SpanRelationQuery} and {@link SpanWithIdQuery} within a custom
+     * element type specified by the elementStr.
+     * 
+     * @param spanRelationQuery a SpanRelationQuery
+     * @param secondClause a SpanWithIdQuery
+     * @param elementStr a custom element interval type
+     * @param matchRight <code>true</code> if the right side have to be matched
+     *        with the specified SpanWithIdQuery, <code>false</code> otherwise.
+     * @param inverseRelation <code>true</code> if the resulting
+     *        {@link RelationPartSpans} is to be ordered by right side
+     *        positions, <code>false</code> otherwise.
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
+            SpanWithIdQuery secondClause, String elementStr,
+            boolean matchRight, boolean inverseRelation, boolean collectPayloads) {
+        super(spanRelationQuery, secondClause, collectPayloads);
+        this.matchRight = matchRight;
+        this.inverseRelation = inverseRelation;
+        elementQuery = new SpanElementQuery(spanRelationQuery.getField(),
+                elementStr);
+    }
 
-	public void setInverseRelation(boolean inverseRelation) {
-		this.inverseRelation = inverseRelation;
-	}
+    /**
+     * * Constructs a SpanRelationPartQuery based on the specified
+     * {@link SpanRelationQuery} and {@link SpanWithIdQuery} within a custom
+     * window length (i.e. number of terms / token positions). A window starts
+     * at the same token position as a relation span, and ends at the start +
+     * window length.
+     * 
+     * @param spanRelationQuery a SpanRelationQuery
+     * @param secondClause a SpanWithIdQuery
+     * @param window a window length
+     * @param matchRight <code>true</code> if the right side have to be matched
+     *        with the specified SpanWithIdQuery, <code>false</code> otherwise.
+     * @param inverseRelation <code>true</code> if the resulting
+     *        {@link RelationPartSpans} is to be ordered by right side
+     *        positions, <code>false</code> otherwise.
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
+            SpanWithIdQuery secondClause, int window, boolean matchRight,
+            boolean inverseRelation, boolean collectPayloads) {
+        super(spanRelationQuery, secondClause, collectPayloads);
+        this.matchRight = matchRight;
+        this.inverseRelation = inverseRelation;
+        this.window = window;
+    }
 
-	public SpanElementQuery getElementQuery() {
-		return elementQuery;
-	}
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return new RelationPartSpans(this, context, acceptDocs, termContexts);
+    }
 
-	public void setElementQuery(SpanElementQuery root) {
-		this.elementQuery = root;
-	}
+    @Override
+    public SimpleSpanQuery clone() {
+        SpanRelationPartQuery sq = new SpanRelationPartQuery(
+                (SpanRelationQuery) this.firstClause,
+                (SpanWithIdQuery) this.secondClause,
+                this.elementQuery.getElementStr(), this.matchRight,
+                this.inverseRelation, this.collectPayloads);
+        return sq;
+    }
 
-	public int getWindow() {
-		return window;
-	}
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("spanRelationWithVariable(");
+        sb.append(firstClause.toString(field));
+        sb.append(",");
+        sb.append(secondClause.toString(field));
+        sb.append(",");
+        sb.append(matchRight ? "matchRight, " : "matchLeft, ");
+        sb.append(",");
+        if (elementQuery != null) {
+            sb.append("element:");
+            sb.append(elementQuery.getElementStr());
+        } else {
+            sb.append("window:");
+            sb.append(this.window);
+        }
+        sb.append(")");
+        sb.append(ToStringUtils.boost(getBoost()));
+        return sb.toString();
+    }
 
-	public void setWindow(int window) {
-		this.window = window;
-	}
+    /**
+     * Tells if the right side of the RelationSpans is to be match.
+     * 
+     * @return <code>true</code> if the right side of the RelationSpans is to be
+     *         match, <code>false</code> otherwise.
+     */
+    public boolean isMatchRight() {
+        return matchRight;
+    }
+
+    /**
+     * Sets which part of the RelationSpans is to be match.
+     * 
+     * @param matchRight <code>true</code> if the right side of the
+     *        RelationSpans is to be match, <code>false</code> otherwise.
+     */
+    public void setMatchRight(boolean matchRight) {
+        this.matchRight = matchRight;
+    }
+
+    /**
+     * Tells if start and end positions of the resulting span should be set from
+     * the right part of the RelationSpans. Normally the start and end positions
+     * of RelationSpans are those of the left part.
+     * 
+     * @return <code>true</code> if the resulting {@link RelationPartSpans} is
+     *         to be ordered by right side positions, <code>false</code>
+     *         otherwise.
+     */
+    public boolean isInverseRelation() {
+        return inverseRelation;
+    }
+
+    /**
+     * Sets if start and end positions of the resulting span should be set from
+     * the right part of the RelationSpans. Normally the start and end positions
+     * of RelationSpans are those of the left part.
+     * 
+     * @param inverseRelation <code>true</code> if the resulting
+     *        {@link RelationPartSpans} is to be ordered by right side
+     *        positions, <code>false</code> otherwise.
+     */
+    public void setInverseRelation(boolean inverseRelation) {
+        this.inverseRelation = inverseRelation;
+    }
+
+    /**
+     * Returns the SpanElementQuery of the custom element interval type.
+     * 
+     * @return the SpanElementQuery of the custom element interval type
+     */
+    public SpanElementQuery getElementQuery() {
+        return elementQuery;
+    }
+
+    /**
+     * Sets the SpanElementQuery of the custom element interval type.
+     * 
+     * @param intervalType the SpanElementQuery of the custom element interval
+     *        type
+     */
+    public void setElementQuery(SpanElementQuery intervalType) {
+        this.elementQuery = intervalType;
+    }
+
+    /**
+     * Returns the custom window length.
+     * 
+     * @return the custom window length.
+     */
+    public int getWindow() {
+        return window;
+    }
+
+    /**
+     * Sets a custom window length.
+     * 
+     * @param window a custom window length
+     */
+    public void setWindow(int window) {
+        this.window = window;
+    }
 }
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 27061b9..8706d8f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
@@ -13,48 +13,88 @@
 
 import de.ids_mannheim.korap.query.spans.RelationSpans;
 
-/** Querying span representing a relation between tokens, elements, 
- * 	or a-token-and-an-element. This class provides two types of query:
- * 	1. querying any relations
- * 	2. querying relations matching certain type of sources/targets, 
- * 	   that are the left or the right sides of the relations. 
- *  
- *  @author margaretha
+/**
+ * SpanRelationQuery retrieves spans representing a relation between tokens,
+ * elements, or a-token-and-an-element. Relation are marked with prefix "<" or
+ * ">". The direction of the angle bracket represents the direction of the 
+ * corresponding relation. <br/><br/>
+ * 
+ * This class provides two types of query:
+ * <ol>
+ * <li>querying any relations, for instance dependency relation "<:xip/syntax-dep_rel".
+ * 
+ * <pre>SpanRelationQuery sq = new SpanRelationQuery(
+ *          new SpanTermQuery(
+ *              new Term("tokens","<:xip/syntax-dep_rel")),
+ *          true); 
+ * </pre>
+ * </li>
+ * <li>querying relations matching a certain type of sources/targets, that are the
+ * left or the right sides of the relations. This query is used within 
+ * {@link SpanRelationPartQuery}, for instance, to retrieve all dependency relations 
+ * "<:xip/syntax-dep_rel" whose sources (right side) are noun phrases. 
+ * <pre>
+ * SpanRelationPartQuery rv =
+ *      new SpanRelationPartQuery(sq, new SpanElementQuery("tokens","np"), true, 
+ *      false, true);
+ * </pre>
+ * </li>
+ * 
+ * </ol>
+ * 
+ * @author margaretha
  * */
 public class SpanRelationQuery extends SpanWithIdQuery {
 
-	public SpanRelationQuery(SpanQuery firstClause, boolean collectPayloads) {
-		super(firstClause, collectPayloads);
-	}
-	
-	// for spanRelationWithVariable
-	public SpanRelationQuery(SpanRelationQuery spanRelationQuery,
-			SpanQuery secondClause, boolean collectPayloads) {
-		super(spanRelationQuery, secondClause, collectPayloads);
-	}
+    /**
+     * Constructs a SpanRelationQuery based on the given span query.
+     * 
+     * @param firstClause a SpanQuery.
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanRelationQuery(SpanQuery firstClause, boolean collectPayloads) {
+        super(firstClause, collectPayloads);
+    }
 
-	@Override
-	public SimpleSpanQuery clone() {
-		SimpleSpanQuery sq = new SpanRelationQuery(
-				(SpanQuery) this.firstClause.clone(),
-				this.collectPayloads);
-		return sq;
-	}
+    /**
+     * Constructs a SpanRelationQuery which embeds another
+     * {@link SpanRelationQuery}. This is useful for querying a relation having
+     * a specific variable.
+     * 
+     * @param spanRelationQuery a SpanRelationQuery
+     * @param secondClause a SpanQuery
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanRelationQuery(SpanRelationQuery spanRelationQuery,
+            SpanQuery secondClause, boolean collectPayloads) {
+        super(spanRelationQuery, secondClause, collectPayloads);
+    }
 
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		return new RelationSpans(this, context, acceptDocs, termContexts);
-	}
+    @Override
+    public SimpleSpanQuery clone() {
+        SimpleSpanQuery sq = new SpanRelationQuery(
+                (SpanQuery) this.firstClause.clone(), this.collectPayloads);
+        return sq;
+    }
 
-	@Override
-	public String toString(String field) {
-		StringBuilder sb = new StringBuilder();		
-		sb.append("spanRelation(");
-		sb.append(firstClause.toString(field));
-		sb.append(")");
-		sb.append(ToStringUtils.boost(getBoost()));
-		return sb.toString();
-	}
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return new RelationSpans(this, context, acceptDocs, termContexts);
+    }
+
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("spanRelation(");
+        sb.append(firstClause.toString(field));
+        sb.append(")");
+        sb.append(ToStringUtils.boost(getBoost()));
+        return sb.toString();
+    }
 
 }
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 230728a..114d882 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanTermWithIdQuery.java
@@ -12,39 +12,47 @@
 
 import de.ids_mannheim.korap.query.spans.TermSpansWithId;
 
-/** This query wraps the usual SpanTermQuery and returns TermSpans with a spanid property.
- * 	This query is used in other spanqueries that require spans with id as their child spans, 
- * 	for example span relation with variable query.
- * 	
- * 	@author margaretha
+/**
+ * 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 (
+ * {@link SpanRelationPartQuery}).
+ * 
+ * @author margaretha
  * */
-public class SpanTermWithIdQuery extends SpanWithIdQuery{
+public class SpanTermWithIdQuery extends SpanWithIdQuery {
 
-	public SpanTermWithIdQuery(Term term, boolean collectPayloads) {
-		super(new SpanTermQuery(term), collectPayloads);		
-	}
+    /**
+     * Constructs a SpanTermWithIdQuery for the given term.
+     * 
+     * @param term a {@link Term}
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanTermWithIdQuery(Term term, boolean collectPayloads) {
+        super(new SpanTermQuery(term), collectPayloads);
+    }
 
-	@Override
-	public SimpleSpanQuery clone() {	
-		SpanTermQuery sq = (SpanTermQuery)  this.firstClause;
-		return new SpanTermWithIdQuery(sq.getTerm(), 
-				this.collectPayloads
-		);
-	}
+    @Override
+    public SimpleSpanQuery clone() {
+        SpanTermQuery sq = (SpanTermQuery) this.firstClause;
+        return new SpanTermWithIdQuery(sq.getTerm(), this.collectPayloads);
+    }
 
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		return new TermSpansWithId(this, context, acceptDocs, termContexts);
-	}
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        return new TermSpansWithId(this, context, acceptDocs, termContexts);
+    }
 
-	@Override
-	public String toString(String field) {
-		StringBuilder sb = new StringBuilder();		
-		sb.append("spanTermWithId(");
-		sb.append(firstClause.toString(field));
-		sb.append(")");		
-		return sb.toString();
-	}
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("spanTermWithId(");
+        sb.append(firstClause.toString(field));
+        sb.append(")");
+        return sb.toString();
+    }
 
 }
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 2c03fdc..d2e8e6f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
@@ -12,119 +12,140 @@
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.util.Bits;
 
-import de.ids_mannheim.korap.query.spans.SpansWithAttribute;
 import de.ids_mannheim.korap.query.spans.ElementSpans;
 import de.ids_mannheim.korap.query.spans.RelationSpans;
+import de.ids_mannheim.korap.query.spans.SpansWithAttribute;
 import de.ids_mannheim.korap.query.spans.TermSpansWithId;
 
-/**	Enumeration of spans (e.g. element or relation spans) having some 
- * 	specific attribute(s) or <em>not</em> having some attribute(s).
+/**
+ * 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.
  * 
- * 	@author margaretha
+ * @author margaretha
  */
-public class SpanWithAttributeQuery extends SpanWithIdQuery{
-		
-	private boolean isMultipleAttributes;
-	private String type;
-	
-	public SpanWithAttributeQuery(SpanWithIdQuery firstClause,
-			SpanAttributeQuery secondClause, boolean collectPayloads) {
-		super(firstClause, secondClause, collectPayloads);
-		setType();
-	}
-	
-	public SpanWithAttributeQuery(SpanWithIdQuery firstClause,
-			List<SpanQuery> secondClauses, boolean collectPayloads) {
-		super(firstClause, secondClauses, collectPayloads);
-		isMultipleAttributes = true;
-		setType();
-	}	
-	
-	public String getType() {
-		return type;
-	}
+public class SpanWithAttributeQuery extends SpanWithIdQuery {
 
-	public void setType() {
-		if (SpanElementQuery.class.isInstance(firstClause)){
-			type = "spanElementWithAttribute"; 
-		}
-		else if (SpanRelationQuery.class.isInstance(firstClause)){
-			type = "spanRelationWithAttribute";	
-		}
-		else if (SpanTermWithIdQuery.class.isInstance(firstClause)){
-			type = "spanTermWithAttribute";	
-		}
-	}
+    private boolean isMultipleAttributes;
+    private String type;
 
-	@Override
-	public SimpleSpanQuery clone() {
-		SpanWithAttributeQuery sq;
-		if (!isMultipleAttributes){			
-			sq = new SpanWithAttributeQuery( 
-					(SpanWithIdQuery) firstClause.clone(), 
-					(SpanAttributeQuery) secondClause.clone(), 
-					collectPayloads);
-		}		
-		else {
-			List<SpanQuery> clauseList = new ArrayList<SpanQuery>();
-			SpanAttributeQuery saq;
-			for (SpanQuery q : this.clauseList ){
-				saq = (SpanAttributeQuery) q;
-				clauseList.add(saq.clone());
-			}
-			sq = new SpanWithAttributeQuery( 
-					(SpanWithIdQuery) firstClause.clone(), 
-					clauseList, 
-					collectPayloads);
-		}
-		return sq;
-	}
+    /**
+     * Constructs a SpanWithAttributeQuery for the specified SpanWithIdQuery and
+     * SpanAttributeQuery retrieving spans having a specific attribute.
+     * 
+     * @param firstClause a SpanWithIdQuery
+     * @param secondClause a SpanAttributeQuery
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanWithAttributeQuery(SpanWithIdQuery firstClause,
+            SpanAttributeQuery secondClause, boolean collectPayloads) {
+        super(firstClause, secondClause, collectPayloads);
+        setType();
+    }
 
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		
-		Spans spans = this.getFirstClause().getSpans(context, acceptDocs, termContexts);
-		
-		if (type.equals("spanElementWithAttribute")){			
-			return new SpansWithAttribute(this, (ElementSpans) spans, 
-					context, acceptDocs, termContexts);
-		}
-		else if (type.equals("spanRelationWithAttribute")){
-			return new SpansWithAttribute(this, (RelationSpans) spans,
-					context, acceptDocs, termContexts);
-		}
-		
-		return new SpansWithAttribute(this, (TermSpansWithId) spans,
-				context, acceptDocs, termContexts);
-	}
+    /**
+     * @param firstClause a SpanWithIdQuery
+     * @param secondClauses a list of SpanAttributeQueries
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanWithAttributeQuery(SpanWithIdQuery firstClause,
+            List<SpanQuery> secondClauses, boolean collectPayloads) {
+        super(firstClause, secondClauses, collectPayloads);
+        isMultipleAttributes = true;
+        setType();
+    }
 
-	@Override
-	public String toString(String field) {
-		
-		StringBuilder sb = new StringBuilder();
-		sb.append(type);
-		sb.append("(");
-		sb.append(firstClause.toString(field));
-		sb.append(", ");
-		if (isMultipleAttributes){
-			sb.append("[");
-			
-			SpanQuery sq;
-			for (int i=0; i < clauseList.size(); i++){
-				sq = clauseList.get(i); 
-				sb.append(sq.toString(field));
-				
-				if (i < clauseList.size() -1)
-					sb.append(", ");
-			}
-			
-			sb.append("]");
-		}
-		else {
-			sb.append(secondClause.toString(field));
-		}
-		sb.append(")");
-		return sb.toString();
-	}
+    /**
+     * Returns the type of the query.
+     * 
+     * @return the type of the query
+     */
+    public String getType() {
+        return type;
+    }
+
+    /** Sets the type of the query based of the class of the firstClause / first span.
+     * 
+     */
+    public void setType() {
+        if (SpanElementQuery.class.isInstance(firstClause)) {
+            type = "spanElementWithAttribute";
+        } else if (SpanRelationQuery.class.isInstance(firstClause)) {
+            type = "spanRelationWithAttribute";
+        } else if (SpanTermWithIdQuery.class.isInstance(firstClause)) {
+            type = "spanTermWithAttribute";
+        }
+    }
+
+    @Override
+    public SimpleSpanQuery clone() {
+        SpanWithAttributeQuery sq;
+        if (!isMultipleAttributes) {
+            sq = new SpanWithAttributeQuery(
+                    (SpanWithIdQuery) firstClause.clone(),
+                    (SpanAttributeQuery) secondClause.clone(), collectPayloads);
+        } else {
+            List<SpanQuery> clauseList = new ArrayList<SpanQuery>();
+            SpanAttributeQuery saq;
+            for (SpanQuery q : this.clauseList) {
+                saq = (SpanAttributeQuery) q;
+                clauseList.add(saq.clone());
+            }
+            sq = new SpanWithAttributeQuery(
+                    (SpanWithIdQuery) firstClause.clone(), clauseList,
+                    collectPayloads);
+        }
+        return sq;
+    }
+
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+
+        Spans spans = this.getFirstClause().getSpans(context, acceptDocs,
+                termContexts);
+
+        if (type.equals("spanElementWithAttribute")) {
+            return new SpansWithAttribute(this, (ElementSpans) spans, context,
+                    acceptDocs, termContexts);
+        } else if (type.equals("spanRelationWithAttribute")) {
+            return new SpansWithAttribute(this, (RelationSpans) spans, context,
+                    acceptDocs, termContexts);
+        }
+
+        return new SpansWithAttribute(this, (TermSpansWithId) spans, context,
+                acceptDocs, termContexts);
+    }
+
+    @Override
+    public String toString(String field) {
+
+        StringBuilder sb = new StringBuilder();
+        sb.append(type);
+        sb.append("(");
+        sb.append(firstClause.toString(field));
+        sb.append(", ");
+        if (isMultipleAttributes) {
+            sb.append("[");
+
+            SpanQuery sq;
+            for (int i = 0; i < clauseList.size(); i++) {
+                sq = clauseList.get(i);
+                sb.append(sq.toString(field));
+
+                if (i < clauseList.size() - 1)
+                    sb.append(", ");
+            }
+
+            sb.append("]");
+        } else {
+            sb.append(secondClause.toString(field));
+        }
+        sb.append(")");
+        return sb.toString();
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanWithIdQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanWithIdQuery.java
index aefd7ce..55e2744 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithIdQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithIdQuery.java
@@ -4,19 +4,56 @@
 
 import org.apache.lucene.search.spans.SpanQuery;
 
-public abstract class SpanWithIdQuery extends SimpleSpanQuery{
+/**
+ * Base query for span queries whose resulting spans requires an id, for
+ * instance {@link SpanElementQuery} and {@link SpanRelationQuery}.
+ * 
+ * @author margaretha
+ * 
+ */
+public abstract class SpanWithIdQuery extends SimpleSpanQuery {
 
-	public SpanWithIdQuery(SpanQuery firstClause, boolean collectPayloads) {
-		super(firstClause, collectPayloads);
-	}
-	
-	public SpanWithIdQuery(SpanQuery firstClause, SpanQuery secondClause,
-			boolean collectPayloads) {
-		super(firstClause, secondClause, collectPayloads);
-	}
-	
-	public SpanWithIdQuery(SpanQuery firstClause,
-			List<SpanQuery> secondClauses, boolean collectPayloads) {
-		super(firstClause, secondClauses, collectPayloads);
-	}
+    /**
+     * Constructs SpanWithIdQuery based on the given {@link SpanQuery} and the
+     * collectPayloads flag, for example, {@link SpanElementQuery}.
+     * 
+     * @param firstClause a SpanQuery
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanWithIdQuery(SpanQuery firstClause, boolean collectPayloads) {
+        super(firstClause, collectPayloads);
+    }
+
+    /**
+     * Constructs SpanWithIdQuery based on two span queries and the
+     * collectPayloads flag, for instance, query a relation having a specific
+     * attribute.
+     * 
+     * @param firstClause a SpanQuery
+     * @param secondClause a SpanQuery
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanWithIdQuery(SpanQuery firstClause, SpanQuery secondClause,
+            boolean collectPayloads) {
+        super(firstClause, secondClause, collectPayloads);
+    }
+
+    /**
+     * Constructs SpanWithIdQuery based on a span query and a list of span
+     * queries, for instance, query an element having two specific attributes.
+     * 
+     * @param firstClause a SpanQuery
+     * @param secondClauses a list of SpanQuery
+     * @param collectPayloads a boolean flag representing the value
+     *        <code>true</code> if payloads are to be collected, otherwise
+     *        <code>false</code>.
+     */
+    public SpanWithIdQuery(SpanQuery firstClause,
+            List<SpanQuery> secondClauses, boolean collectPayloads) {
+        super(firstClause, secondClauses, collectPayloads);
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
index 8b8d90b..f01bd1f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
@@ -14,161 +14,182 @@
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.search.spans.TermSpans;
 import org.apache.lucene.util.Bits;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import de.ids_mannheim.korap.query.SpanElementQuery;
 
-/**  
- * @author Nils Diewald, margaretha
- *
- * Use copyFrom instead of clone
+/**
+ * Enumeration of spans which are elements such as phrases, sentences and
+ * paragraphs.
+ * 
+ * @author margaretha
+ * @author Nils Diewald
  */
 public class ElementSpans extends SpansWithId {
 
-	private List<CandidateElementSpans> candidateList;
-	private int currentDoc, currentPosition;
-	private TermSpans termSpans;	
-	
-	private Logger logger = LoggerFactory.getLogger(ElementSpans.class);
+    private List<CandidateElementSpan> candidateList;
+    private int currentDoc, currentPosition;
+    private TermSpans termSpans;
 
-	public ElementSpans(SpanElementQuery spanElementQuery,
-			AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		super(spanElementQuery, context, acceptDocs, termContexts);
-		candidateList = new ArrayList<>();
-		termSpans = (TermSpans) firstSpans;
-		hasMoreSpans = termSpans.next();
-		if (hasMoreSpans) {
-			currentDoc = termSpans.doc();
-			currentPosition = termSpans.start();
-		}
-	}
+    /**
+     * Constructs ElementSpans for the given {@link SpanElementQuery}.
+     * 
+     * @param spanElementQuery a SpanElementQuery
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public ElementSpans(SpanElementQuery spanElementQuery,
+            AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        super(spanElementQuery, context, acceptDocs, termContexts);
+        candidateList = new ArrayList<>();
+        termSpans = (TermSpans) firstSpans;
+        hasMoreSpans = termSpans.next();
+        if (hasMoreSpans) {
+            currentDoc = termSpans.doc();
+            currentPosition = termSpans.start();
+        }
+    }
 
-	@Override
-	public boolean next() throws IOException {
-		isStartEnumeration=false;
-		return advance();
-	}
-	
-	/**	Get the next match by first checking the candidate match list
-	 * 	and setting the list when it is empty.
-	 * */
-	private boolean advance() throws IOException {
-		while(hasMoreSpans || !candidateList.isEmpty()){
-			if (!candidateList.isEmpty()){
-				CandidateElementSpans cs = candidateList.get(0);
-				this.matchDocNumber = cs.getDoc();
-				this.matchStartPosition = cs.getStart();
-				this.matchEndPosition = cs.getEnd();
-				this.matchPayload = cs.getPayloads();				
-				//this.setElementRef(cs.getSpanId());				
-				this.setSpanId(cs.getSpanId());
-				candidateList.remove(0);
-				return true;
-			}
-			else{
-			    //logger.info("Setting candidate list");
-				setCandidateList();				
-				currentDoc = termSpans.doc();
-				currentPosition = termSpans.start();
-			}
-		}
-		return false;
-	}
+    @Override
+    public boolean next() throws IOException {
+        isStartEnumeration = false;
+        return advance();
+    }
 
-	/**	Collect all the elements in the same start position and sort them by
-	 * 	end position (smallest first).
-	 * */
-	private void setCandidateList() throws IOException {
-		while (hasMoreSpans &&	termSpans.doc() == currentDoc && 
-				termSpans.start() == currentPosition){
-			CandidateElementSpans cs = new CandidateElementSpans(termSpans,
-					spanId);
-					//elementRef);
-			readPayload(cs);
-			candidateList.add(cs);
-			hasMoreSpans = termSpans.next();
-		}
-		Collections.sort(candidateList);
-	}
-	
-	
-	/**	This method reads the payload of the termSpan and assigns the end 
-	 * 	position and element ref to the candidate match. The character offset
-	 *  payload is set as the candidate match payload.
-	 *  <br/><br/>
-	 * 	<em>Note</em>: payloadbuffer should actually collects all other payload
-	 * 	beside end position and element ref, but KorapIndex identify element's 
-	 * 	payload by its length (8), which is only the character offsets. So
-	 * 	these offsets are directly set as the candidate match payload.	
-	 * 
-	 * 	@author margaretha
-	 * */
-	private void readPayload(CandidateElementSpans cs) throws IOException {   	
-		List<byte[]> payload = (List<byte[]>) termSpans.getPayload();
-		int length = payload.get(0).length;
-		ByteBuffer bb = ByteBuffer.allocate(length);
-		bb.put(payload.get(0));
-		
-	    if (!payload.isEmpty()) {
-			// set element end position from payload
-			cs.setEnd(bb.getInt(8));
-			
-			if (hasSpanId){ // copy element id
-				cs.setSpanId(bb.getShort(12));
-			}
-			else{ // set element id -1
-				cs.setSpanId((short) -1);
-			}
-			// Copy the start and end character offsets
-			byte[] b = new byte[8];			
-			b = Arrays.copyOfRange(bb.array(), 0, 8);
-			cs.setPayloads(Collections.singletonList(b));
-	    }
-	    else {	
-			cs.setEnd(cs.getStart());
-			cs.setSpanId((short) -1);
-			cs.setPayloads(null);
-    	}
-	}
-	
-	@Override
-	public boolean skipTo(int target) throws IOException {
-		if (hasMoreSpans && (firstSpans.doc() < target)){
-  			if (!firstSpans.skipTo(target)){
-  				candidateList.clear();
-  				return false;
-  			}
-  		}		
-		setCandidateList();
-		matchPayload.clear();
-		isStartEnumeration=false;
-		return advance();
-	}
+    /**
+     * Advances the ElementSpans to the next match by first checking the
+     * candidate match list. If the list is empty, it will be set/filled in
+     * first. Tells if there is a next match or not.
+     * 
+     * @return <code>true</code> if a match is found, <code>false</code>
+     *         otherwise.
+     * @throws IOException
+     */
+    private boolean advance() throws IOException {
+        while (hasMoreSpans || !candidateList.isEmpty()) {
+            if (!candidateList.isEmpty()) {
+                CandidateElementSpan cs = candidateList.get(0);
+                this.matchDocNumber = cs.getDoc();
+                this.matchStartPosition = cs.getStart();
+                this.matchEndPosition = cs.getEnd();
+                this.matchPayload = cs.getPayloads();
+                // this.setElementRef(cs.getSpanId());
+                this.setSpanId(cs.getSpanId());
+                candidateList.remove(0);
+                return true;
+            } else {
+                // logger.info("Setting candidate list");
+                setCandidateList();
+                currentDoc = termSpans.doc();
+                currentPosition = termSpans.start();
+            }
+        }
+        return false;
+    }
 
-	@Override
-	public long cost() {
-		return termSpans.cost();
-	}
-	
-	/** Match candidate for element spans.
-	 * */	
-	class CandidateElementSpans extends CandidateSpan {
-		
-		private short elementRef;
-		
-		public CandidateElementSpans(Spans span, short elementRef) 
-				throws IOException {
-			super(span);
-			setSpanId(elementRef);
-		}
-		
-		public void setSpanId(short elementRef) {
-			this.elementRef = elementRef;
-		}
-		public short getSpanId() {
-			return elementRef;
-		}	
-	}
+    /**
+     * Collects all the elements starting at the same position and sort them by
+     * their end positions. The list starts with the element having the smallest
+     * end position.
+     * 
+     * @throws IOException
+     */
+    private void setCandidateList() throws IOException {
+        while (hasMoreSpans && termSpans.doc() == currentDoc
+                && termSpans.start() == currentPosition) {
+            CandidateElementSpan cs = new CandidateElementSpan(termSpans,
+                    spanId);
+            // elementRef);
+            readPayload(cs);
+            candidateList.add(cs);
+            hasMoreSpans = termSpans.next();
+        }
+        Collections.sort(candidateList);
+    }
+
+    /**
+     * Reads the payloads of the termSpan and sets the end position and element
+     * id from the payloads for the candidate match. The payloads for
+     * character-offsets are set as the candidate match payloads. <br/>
+     * <br/>
+     * <em>Note</em>: payloadbuffer should actually collects all other payload
+     * beside end position and element id, but KorapIndex identify element's
+     * payloads by its length (8), which represents the character offset
+     * payloads. So these offsets are directly set as the candidate match
+     * payload.
+     * 
+     * @param cs a candidate match
+     * @throws IOException
+     */
+    private void readPayload(CandidateElementSpan cs) throws IOException {
+        List<byte[]> payload = (List<byte[]>) termSpans.getPayload();
+        int length = payload.get(0).length;
+        ByteBuffer bb = ByteBuffer.allocate(length);
+        bb.put(payload.get(0));
+
+        if (!payload.isEmpty()) {
+            // set element end position from payload
+            cs.setEnd(bb.getInt(8));
+
+            if (hasSpanId) { // copy element id
+                cs.setSpanId(bb.getShort(12));
+            } else { // set element id -1
+                cs.setSpanId((short) -1);
+            }
+            // Copy the start and end character offsets
+            byte[] b = new byte[8];
+            b = Arrays.copyOfRange(bb.array(), 0, 8);
+            cs.setPayloads(Collections.singletonList(b));
+        } else {
+            cs.setEnd(cs.getStart());
+            cs.setSpanId((short) -1);
+            cs.setPayloads(null);
+        }
+    }
+
+    @Override
+    public boolean skipTo(int target) throws IOException {
+        if (hasMoreSpans && (firstSpans.doc() < target)) {
+            if (!firstSpans.skipTo(target)) {
+                candidateList.clear();
+                return false;
+            }
+        }
+        setCandidateList();
+        matchPayload.clear();
+        isStartEnumeration = false;
+        return advance();
+    }
+
+    @Override
+    public long cost() {
+        return termSpans.cost();
+    }
+
+    /**
+     * Match candidate for element spans.
+     * 
+     * @author margaretha
+     * 
+     */
+    class CandidateElementSpan extends CandidateSpan {
+
+        private short elementId;
+
+        public CandidateElementSpan(Spans span, short elementId)
+                throws IOException {
+            super(span);
+            setSpanId(elementId);
+        }
+
+        public void setSpanId(short elementId) {
+            this.elementId = elementId;
+        }
+
+        public short getSpanId() {
+            return elementId;
+        }
+    }
 };
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
index f1d836a..de4b8e6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
@@ -10,25 +10,47 @@
 
 import de.ids_mannheim.korap.query.SpanWithIdQuery;
 
-/** Base class for span enumeration with spanid property.
- * 	@author margaretha
+/**
+ * Base class for enumeration of span requiring an id, such as elements and
+ * relations.
+ * 
+ * @author margaretha
  * */
-public abstract class SpansWithId extends SimpleSpans{
+public abstract class SpansWithId extends SimpleSpans {
 
-	protected short spanId;
-	protected boolean hasSpanId = false; // A dummy flag
-	
-	public SpansWithId(SpanWithIdQuery spanWithIdQuery,
-			AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		super(spanWithIdQuery, context, acceptDocs, termContexts);
-	}
+    protected short spanId;
+    protected boolean hasSpanId = false; // A dummy flag
 
-	public short getSpanId() {
-		return spanId;
-	}
+    /**
+     * Constructs SpansWithId for the given {@link SpanWithIdQuery}.
+     * 
+     * @param spanWithIdQuery a SpanWithIdQuery
+     * @param context
+     * @param acceptDocs
+     * @param termContexts
+     * @throws IOException
+     */
+    public SpansWithId(SpanWithIdQuery spanWithIdQuery,
+            AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
+        super(spanWithIdQuery, context, acceptDocs, termContexts);
+    }
 
-	public void setSpanId(short spanId) {
-		this.spanId = spanId;
-	}
+    /**
+     * Returns the span id of the current span
+     * 
+     * @return the span id of the current span
+     */
+    public short getSpanId() {
+        return spanId;
+    }
+
+    /**
+     * Sets the span id of the current span
+     * 
+     * @param spanId span id
+     */
+    public void setSpanId(short spanId) {
+        this.spanId = spanId;
+    }
 }
