diff --git a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
index 6a0668f..0bb3e43 100644
--- a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
@@ -1,10 +1,49 @@
 package de.ids_mannheim.korap.query;
 
 /**
- * Specify distance constraints in SpanDistanceQueries or
- * SpanMultipleDistanceQueries
+ * DistanceConstraint specifies the constraints used in
+ * {@link SpanDistanceQueries} or {@link SpanMultipleDistanceQueries}. The
+ * constraints comprise the distance unit, the minimum and maximum distance, the
+ * order and the co-occurence of the compared spans.
  * 
+ * Distance constraint examples:
  * 
+ * <ol>
+ * <li>Two terms x and y are separated by minimum two and maximum three other
+ * words. The order of x and y does not matter.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, false, false);
+ * </pre>
+ * 
+ * </li>
+ * <li>Two terms x and y are separated by minimum two and maximum three other
+ * words. X must precede y.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, true, false);
+ * </pre>
+ * 
+ * </li>
+ * <li>
+ * Term x do not occur with term y in minimum two and maximum three other words.
+ * X must precede y.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, true, true);
+ * </pre>
+ * 
+ * </li>
+ * <li>Two terms x and y separated by minimum one and maximum two
+ * <em>sentences</em>. X must precede y.
+ * 
+ * <pre>
+ * SpanElementQuery e = new SpanElementQuery(&quot;tokens&quot;, &quot;s&quot;);
+ * DistanceConstraint dc = new DistanceConstraint(e, 2, 3, true, false);
+ * </pre>
+ * 
+ * </li>
+ * </ol>
  * 
  * @author margaretha
  * */
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
index 87616c9..d8083c6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
@@ -18,144 +18,252 @@
 import de.ids_mannheim.korap.query.spans.UnorderedElementDistanceSpans;
 import de.ids_mannheim.korap.query.spans.UnorderedTokenDistanceSpans;
 
-/** Match two ordered or unordered spans with some minimum and maximum 
- * 	distance constraints. The distance unit can be word (token), 
- * 	sentence or paragraph. The distance can also be specified to match 
- * 	some spans which do <em>not</em> co-occur with some other Spans within a min 
- * 	and max distance. 
+/**
+ * SpanDistanceQuery calculates the distance between two spans and compares it
+ * to the distance constraints. The distance constraints are specified as a
+ * {@link DistanceConstraint} instance having various properties: the distance
+ * unit, the order of the spans (ordered or unordered), co-occurrence (i.e. the
+ * spans should co-occur or not), minimum and maximum distance. <br/>
+ * <br/>
+ * The distance unit can be word (token), sentence or paragraph. The resulting
+ * spans typically stretch from the starting position of a former span to the
+ * end position of the latter span. <br/>
+ * <br/>
+ * Query examples:
  * 
- * 	@author margaretha
+ * <ol>
+ * <li>Search two terms x and y which are separated by minimum two and maximum
+ * three other words. The order of x and y does not matter.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, false, false);
+ * </pre>
+ * 
+ * </li>
+ * <li>Search two terms x and y which are separated by minimum two and maximum
+ * three other words. X must precede y.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, true, false);
+ * </pre>
+ * 
+ * </li>
+ * <li>
+ * Search term x which do not occur with term y in minimum two and maximum three
+ * other words. X must precede y.
+ * 
+ * <pre>
+ * DistanceConstraint dc = new DistanceConstraint(2, 3, true, true);
+ * </pre>
+ * 
+ * </li>
+ * <li>Search two terms x and y separated by minimum one and maximum two
+ * sentences. X must precede y.
+ * 
+ * <pre>
+ * SpanElementQuery e = new SpanElementQuery(&quot;tokens&quot;, &quot;s&quot;);
+ * DistanceConstraint dc = new DistanceConstraint(e, 2, 3, true, false);
+ * </pre>
+ * 
+ * </li>
+ * </ol>
+ * 
+ * SpanDistanceQuery examples:
+ * 
+ * <ol>
+ * <li>
+ * 
+ * <pre>
+ * SpanDistanceQuery sq = new SpanDistanceQuery(new SpanTermQuery(new Term(
+ *         &quot;tokens&quot;, x)), new SpanTermQuery(new Term(&quot;tokens&quot;, y)), dc, true);
+ * </pre>
+ * 
+ * </li>
+ * <li>
+ * 
+ * <pre>
+ * SpanDistanceQuery sq = new SpanDistanceQuery(
+ *         new SpanElementQuery(&quot;tokens&quot;, &quot;s&quot;), new SpanElementQuery(&quot;tokens&quot;, y),
+ *         dc, true);
+ * </pre>
+ * 
+ * </li>
+ * </ol>
+ * 
+ * 
+ * @author margaretha
  * */
 public class SpanDistanceQuery extends SimpleSpanQuery {
-	
-	private boolean exclusion;
-	private boolean isOrdered;	
-	private int minDistance, maxDistance;	
-	private SpanElementQuery elementQuery; // element distance unit (sentence or paragraph)
-	private String distanceUnit;
-	private String spanName;
-	private DistanceConstraint constraint;
 
-	public SpanDistanceQuery(SpanQuery firstClause, SpanQuery secondClause, 
-			DistanceConstraint constraint, boolean collectPayloads) {
-		super(firstClause, secondClause, collectPayloads);
-		
-		if (constraint == null){
-			throw new IllegalArgumentException("Distance constraint cannot be null.");
-		}
-		
-		this.constraint = constraint;
-		this.minDistance = constraint.getMinDistance();
-		this.maxDistance = constraint.getMaxDistance();
-		this.isOrdered = constraint.isOrdered();
-		this.exclusion = constraint.isExclusion();
-		this.distanceUnit = constraint.getUnit();
-		
-		if (constraint.getElementQuery() != null){
-			spanName = "spanElementDistance";
-			this.elementQuery = constraint.getElementQuery();
-		}
-		else { spanName = "spanDistance"; }
-	}
-	
-	@Override
-	public String toString(String field) {
-		StringBuilder sb = new StringBuilder();
-		sb.append(this.spanName);
-		sb.append("(");
-		sb.append(firstClause.toString(field));
-	    sb.append(", ");
-		sb.append(secondClause.toString(field));
-		sb.append(", ");
-		sb.append("[(");
-		sb.append(distanceUnit);
-		sb.append("[");
-		sb.append(minDistance);
-		sb.append(":");
-		sb.append(maxDistance);
-		sb.append("], ");		
-		sb.append( isOrdered ? "ordered, " : "notOrdered, " );
-		sb.append( exclusion ? "excluded)])" : "notExcluded)])");
-		sb.append(ToStringUtils.boost(getBoost()));
-    	return sb.toString();
+    private boolean exclusion;
+    private boolean isOrdered;
+    private int minDistance, maxDistance;
+    private SpanElementQuery elementQuery; // element distance unit (sentence or
+                                           // paragraph)
+    private String distanceUnit;
+    private String spanName;
+    private DistanceConstraint constraint;
+
+    /**
+     * Constructs a SpanDistanceQuery comparing the distance between the spans
+     * of the two specified spanqueries and based-on the given distance
+     * constraints.
+     * 
+     * */
+    public SpanDistanceQuery(SpanQuery firstClause, SpanQuery secondClause,
+            DistanceConstraint constraint, boolean collectPayloads) {
+        super(firstClause, secondClause, collectPayloads);
+
+        if (constraint == null) {
+            throw new IllegalArgumentException(
+                    "Distance constraint cannot be null.");
+        }
+
+        this.constraint = constraint;
+        this.minDistance = constraint.getMinDistance();
+        this.maxDistance = constraint.getMaxDistance();
+        this.isOrdered = constraint.isOrdered();
+        this.exclusion = constraint.isExclusion();
+        this.distanceUnit = constraint.getUnit();
+
+        if (constraint.getElementQuery() != null) {
+            spanName = "spanElementDistance";
+            this.elementQuery = constraint.getElementQuery();
+        } else {
+            spanName = "spanDistance";
+        }
     }
-	
-	@Override
-	public SpanDistanceQuery clone() {		
-		SpanDistanceQuery spanDistanceQuery = new SpanDistanceQuery(
-		    (SpanQuery) firstClause.clone(),
-		    (SpanQuery) secondClause.clone(),
-		    this.constraint,
-		    this.collectPayloads
-        );
-				
-		if (this.elementQuery != null) {
-			spanDistanceQuery.setElementQuery(this.elementQuery);
-		}
-		spanDistanceQuery.setBoost(getBoost());
-		return spanDistanceQuery;	
-	}
 
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {		
-		
-		if (this.elementQuery != null) {
-			if (isExclusion()){
-				return new ElementDistanceExclusionSpans(this, context, acceptDocs, 
-						termContexts, isOrdered);
-			}			
-			else if (isOrdered){
-				return new ElementDistanceSpans(this, context, acceptDocs, 
-						termContexts);
-			}
-			return new UnorderedElementDistanceSpans(this, context, acceptDocs, 
-					termContexts);
-			
-		}
-		else if (isExclusion()){
-			return new DistanceExclusionSpans(this, context, acceptDocs, 
-					termContexts, isOrdered);
-		}
-		else if (isOrdered) {
-			return new TokenDistanceSpans(this, context, acceptDocs, 
-					termContexts);		
-		}
-		return new UnorderedTokenDistanceSpans(this, context, acceptDocs, 
-				termContexts);
-	}
+    @Override
+    public String toString(String field) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(this.spanName);
+        sb.append("(");
+        sb.append(firstClause.toString(field));
+        sb.append(", ");
+        sb.append(secondClause.toString(field));
+        sb.append(", ");
+        sb.append("[(");
+        sb.append(distanceUnit);
+        sb.append("[");
+        sb.append(minDistance);
+        sb.append(":");
+        sb.append(maxDistance);
+        sb.append("], ");
+        sb.append(isOrdered ? "ordered, " : "notOrdered, ");
+        sb.append(exclusion ? "excluded)])" : "notExcluded)])");
+        sb.append(ToStringUtils.boost(getBoost()));
+        return sb.toString();
+    }
 
-	public int getMinDistance() {
-		return minDistance;
-	}
+    @Override
+    public SpanDistanceQuery clone() {
+        SpanDistanceQuery spanDistanceQuery = new SpanDistanceQuery(
+                (SpanQuery) firstClause.clone(),
+                (SpanQuery) secondClause.clone(), this.constraint,
+                this.collectPayloads);
 
-	public void setMinDistance(int minDistance) {
-		this.minDistance = minDistance;
-	}
+        if (this.elementQuery != null) {
+            spanDistanceQuery.setElementQuery(this.elementQuery);
+        }
+        spanDistanceQuery.setBoost(getBoost());
+        return spanDistanceQuery;
+    }
 
-	public int getMaxDistance() {
-		return maxDistance;
-	}
+    @Override
+    public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
+            Map<Term, TermContext> termContexts) throws IOException {
 
-	public void setMaxDistance(int maxDistance) {
-		this.maxDistance = maxDistance;
-	}
-	
-	public SpanElementQuery getElementQuery() {
-		return elementQuery;
-	}
-	
-	public void setElementQuery(SpanElementQuery elementQuery) {
-		this.elementQuery = elementQuery;
-	}
+        if (this.elementQuery != null) {
+            if (isExclusion()) {
+                return new ElementDistanceExclusionSpans(this, context,
+                        acceptDocs, termContexts, isOrdered);
+            } else if (isOrdered) {
+                return new ElementDistanceSpans(this, context, acceptDocs,
+                        termContexts);
+            }
+            return new UnorderedElementDistanceSpans(this, context, acceptDocs,
+                    termContexts);
 
-	public boolean isExclusion() {
-		return exclusion;
-	}
+        } else if (isExclusion()) {
+            return new DistanceExclusionSpans(this, context, acceptDocs,
+                    termContexts, isOrdered);
+        } else if (isOrdered) {
+            return new TokenDistanceSpans(this, context, acceptDocs,
+                    termContexts);
+        }
+        return new UnorderedTokenDistanceSpans(this, context, acceptDocs,
+                termContexts);
+    }
 
-	public void setExclusion(boolean exclusion) {
-		this.exclusion = exclusion;
-	}
+    /**
+     * Returns the minimum distance constraint
+     * 
+     * @return minimum distance constraint
+     */
+    public int getMinDistance() {
+        return minDistance;
+    }
 
+    /**
+     * Sets the minimum distance constraint
+     * 
+     * @param minDistance
+     */
+    public void setMinDistance(int minDistance) {
+        this.minDistance = minDistance;
+    }
+
+    /**
+     * Returns the maximum distance constraint
+     * 
+     * @return maximum distance constraint
+     */
+    public int getMaxDistance() {
+        return maxDistance;
+    }
+
+    /**
+     * Sets a maximum distance constraint
+     * 
+     * @param maxDistance
+     */
+    public void setMaxDistance(int maxDistance) {
+        this.maxDistance = maxDistance;
+    }
+
+    /**
+     * Returns the element query used as the distance unit
+     * 
+     * @return the element distance unit
+     */
+    public SpanElementQuery getElementQuery() {
+        return elementQuery;
+    }
+
+    /**
+     * Sets the specified element query used for the distance unit
+     * 
+     * @param elementQuery
+     */
+    public void setElementQuery(SpanElementQuery elementQuery) {
+        this.elementQuery = elementQuery;
+    }
+
+    /**
+     * Tells weather the second sub-span should co-occur or not.
+     * */
+    public boolean isExclusion() {
+        return exclusion;
+    }
+
+    /**
+     * Sets true if the second sub-span should <em>not</em> co-occur.
+     * 
+     * @param exclusion
+     */
+    public void setExclusion(boolean exclusion) {
+        this.exclusion = exclusion;
+    }
 
 }
