Renamed some spans
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 b8b7bd3..87616c9 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
@@ -11,8 +11,8 @@
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ToStringUtils;
 
-import de.ids_mannheim.korap.query.spans.DistanceExclusionSpan;
-import de.ids_mannheim.korap.query.spans.ElementDistanceExclusionSpan;
+import de.ids_mannheim.korap.query.spans.DistanceExclusionSpans;
+import de.ids_mannheim.korap.query.spans.ElementDistanceExclusionSpans;
 import de.ids_mannheim.korap.query.spans.ElementDistanceSpans;
 import de.ids_mannheim.korap.query.spans.TokenDistanceSpans;
 import de.ids_mannheim.korap.query.spans.UnorderedElementDistanceSpans;
@@ -102,7 +102,7 @@
 		
 		if (this.elementQuery != null) {
 			if (isExclusion()){
-				return new ElementDistanceExclusionSpan(this, context, acceptDocs, 
+				return new ElementDistanceExclusionSpans(this, context, acceptDocs, 
 						termContexts, isOrdered);
 			}			
 			else if (isOrdered){
@@ -114,7 +114,7 @@
 			
 		}
 		else if (isExclusion()){
-			return new DistanceExclusionSpan(this, context, acceptDocs, 
+			return new DistanceExclusionSpans(this, context, acceptDocs, 
 					termContexts, isOrdered);
 		}
 		else if (isOrdered) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationWithVariableQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
similarity index 81%
rename from src/main/java/de/ids_mannheim/korap/query/SpanRelationWithVariableQuery.java
rename to src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
index 359ca75..c5a58c4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationWithVariableQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationPartQuery.java
@@ -10,14 +10,14 @@
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ToStringUtils;
 
-import de.ids_mannheim.korap.query.spans.RelationSpansWithVariable;
+import de.ids_mannheim.korap.query.spans.RelationPartSpans;
 
-/** This query match one side of a relation (either left or right) to certain 
- * 	elements or terms, and return the other side of the relation.	
+/** 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.	
  * 
  * 	@author margaretha
  * */
-public class SpanRelationWithVariableQuery extends SpanWithIdQuery{
+public class SpanRelationPartQuery extends SpanWithIdQuery{
 	
 	private static String elementStr = "s"; // default element interval type
 	
@@ -25,14 +25,14 @@
 	private boolean matchRight;  // if false, match left
 	private int window;
 	
-	public SpanRelationWithVariableQuery(SpanRelationQuery spanRelationQuery,
+	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
 			SpanWithIdQuery secondClause, // match tokenWithIdQuery, ElementQuery, RelationQuery
 			boolean matchRight,
 			boolean collectPayloads) {
 		this(spanRelationQuery, secondClause, elementStr, matchRight, collectPayloads);		
 	}
 	
-	public SpanRelationWithVariableQuery(SpanRelationQuery spanRelationQuery,
+	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
 			SpanWithIdQuery secondClause, 
 			String elementStr,
 			boolean matchRight,
@@ -42,7 +42,7 @@
 		elementQuery = new SpanElementQuery(spanRelationQuery.getField(), elementStr);		
 	}
 	
-	public SpanRelationWithVariableQuery(SpanRelationQuery spanRelationQuery,
+	public SpanRelationPartQuery(SpanRelationQuery spanRelationQuery,
 			SpanWithIdQuery secondClause, // match tokenWithIdQuery, ElementQuery, RelationQuery
 			int window,
 			boolean matchRight,
@@ -55,12 +55,12 @@
 	@Override
 	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts) throws IOException {
-			return new RelationSpansWithVariable(this, context, acceptDocs, termContexts);
+			return new RelationPartSpans(this, context, acceptDocs, termContexts);
 	}
 	
 	@Override
 	public SimpleSpanQuery clone() {
-		SpanRelationWithVariableQuery sq = new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery sq = new SpanRelationPartQuery(
 				(SpanRelationQuery) this.firstClause, 
 				(SpanWithIdQuery) this.secondClause,
 				this.elementQuery.getElementStr(),
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
index 13fa867..0966e1d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
@@ -158,8 +158,8 @@
 	
 	/** Match candidate for attribute spans.
 	 * */
-	class CandidateAttributeSpan extends CandidateSpan 
-			implements Comparable<CandidateSpan>{
+	class CandidateAttributeSpan extends CandidateSpans 
+			implements Comparable<CandidateSpans>{
 
 		private short spanId;
 		
@@ -177,7 +177,7 @@
 		}
 
 		@Override
-		public int compareTo(CandidateSpan o) {
+		public int compareTo(CandidateSpans o) {
 			CandidateAttributeSpan cs = (CandidateAttributeSpan) o;
 			if (this.spanId == cs.spanId)
 				return 0;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpans.java
similarity index 83%
rename from src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpans.java
index 48fdd90..2442f04 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpans.java
@@ -9,16 +9,16 @@
 /** A span kept as a candidate for matching with another Span
  * 	@author margaretha
  * */
-public class CandidateSpan implements Comparable<CandidateSpan>{	
+public class CandidateSpans implements Comparable<CandidateSpans>{	
 	private int doc,start,end;
 	private long cost;
 	private Collection<byte[]> payloads = new ArrayList<>();
 	private int position;
-	private CandidateSpan childSpan; // used for multiple distance with unordered constraint 
+	private CandidateSpans childSpan; // used for multiple distance with unordered constraint 
 	private short elementRef;
 	
 	
-	public CandidateSpan(Spans span) throws IOException {
+	public CandidateSpans(Spans span) throws IOException {
 		this.doc = span.doc();
 		this.start = span.start();
 		this.end = span.end();
@@ -36,12 +36,12 @@
 		}		*/
 	}	
 	
-	public CandidateSpan(Spans span, int position) throws IOException {
+	public CandidateSpans(Spans span, int position) throws IOException {
 		this(span);
 		this.position = position;		
 	}
 	
-	public CandidateSpan(int start, int end, int doc, long cost,
+	public CandidateSpans(int start, int end, int doc, long cost,
 			Collection<byte[]> payloads) {
 		this.start = start;
 		this.end = end;
@@ -99,11 +99,11 @@
 		this.position = position;
 	}
 
-	public CandidateSpan getChildSpan() {
+	public CandidateSpans getChildSpan() {
 		return childSpan;
 	}
 
-	public void setChildSpan(CandidateSpan childSpan) {
+	public void setChildSpan(CandidateSpans childSpan) {
 		this.childSpan = childSpan;
 	}
 
@@ -116,7 +116,7 @@
 	}
 
 	@Override
-	public int compareTo(CandidateSpan o) {
+	public int compareTo(CandidateSpans o) {
 		if (this.doc == o.doc){
 			if (this.getStart() == o.getStart()){
 				if (this.getEnd() == o.getEnd())
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
similarity index 94%
rename from src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpan.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
index 40ff4ca..5e3fc1d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
@@ -15,7 +15,7 @@
  * 
  * 	@author margaretha
  * */
-public class DistanceExclusionSpan extends DistanceSpans{
+public class DistanceExclusionSpans extends DistanceSpans{
 	
 	private int minDistance, maxDistance;
 	private boolean isOrdered;
@@ -24,7 +24,7 @@
         // This advices the java compiler to ignore all loggings
         public static final boolean DEBUG = false;
 
-	public DistanceExclusionSpan(SpanDistanceQuery query,
+	public DistanceExclusionSpans(SpanDistanceQuery query,
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts, boolean isOrdered) 
 			throws IOException {
@@ -106,7 +106,7 @@
   		if (collectPayloads && firstSpans.isPayloadAvailable())
 	    	matchPayload.addAll(firstSpans.getPayload());
   		
-  		setMatchFirstSpan(new CandidateSpan(firstSpans));
+  		setMatchFirstSpan(new CandidateSpans(firstSpans));
   		//setMatchSecondSpan(new CandidateSpan(secondSpans));
   		
 		if (DEBUG)
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
index 4ce39c3..a89aa17 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceSpans.java
@@ -22,7 +22,7 @@
  * */
 public abstract class DistanceSpans extends SimpleSpans{	
 
-	protected CandidateSpan matchFirstSpan,matchSecondSpan;	
+	protected CandidateSpans matchFirstSpan,matchSecondSpan;	
 	protected Logger log = LoggerFactory.getLogger(DistanceSpans.class);
 	protected boolean exclusion; // because MultipleDistanceQuery doesn't have this property
     
@@ -70,19 +70,19 @@
   		return false;
 	}*/
 	
-	public CandidateSpan getMatchFirstSpan() {
+	public CandidateSpans getMatchFirstSpan() {
 		return matchFirstSpan;
 	}
 
-	public void setMatchFirstSpan(CandidateSpan matchFirstSpan) {
+	public void setMatchFirstSpan(CandidateSpans matchFirstSpan) {
 		this.matchFirstSpan = matchFirstSpan;
 	}
 
-	public CandidateSpan getMatchSecondSpan() {
+	public CandidateSpans getMatchSecondSpan() {
 		return matchSecondSpan;
 	}
 
-	public void setMatchSecondSpan(CandidateSpan matchSecondSpan) {
+	public void setMatchSecondSpan(CandidateSpans matchSecondSpan) {
 		this.matchSecondSpan = matchSecondSpan;
 	}
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
similarity index 87%
rename from src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpan.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
index b8fc20f..24008bd 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceExclusionSpans.java
@@ -21,7 +21,7 @@
  * 
  * 	@author margaretha
  * */
-public class ElementDistanceExclusionSpan extends DistanceSpans{
+public class ElementDistanceExclusionSpans extends DistanceSpans{
 
 	private Spans elements;
 	private boolean hasMoreElements;
@@ -30,7 +30,7 @@
 	private boolean isOrdered;
 	private boolean hasMoreSecondSpans;
 		
-	protected List<CandidateSpan> candidateList, targetList;	
+	protected List<CandidateSpans> candidateList, targetList;	
 	private int currentDocNum;
 	
 	private int minDistance, maxDistance;
@@ -38,7 +38,7 @@
 
         public static final boolean DEBUG = false;
 
-	public ElementDistanceExclusionSpan(SpanDistanceQuery query,
+	public ElementDistanceExclusionSpans(SpanDistanceQuery query,
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts, boolean isOrdered) 
 			throws IOException {
@@ -52,8 +52,8 @@
   		
   		elementPosition=0;
   		this.isOrdered = isOrdered;
-  		candidateList = new ArrayList<CandidateSpan>();
-  		targetList = new ArrayList<CandidateSpan>();
+  		candidateList = new ArrayList<CandidateSpans>();
+  		targetList = new ArrayList<CandidateSpans>();
   		currentDocNum = firstSpans.doc();
   		
   		minDistance = query.getMinDistance();
@@ -73,7 +73,7 @@
 	}
 	
 	private boolean isTargetValid() throws IOException{
-		CandidateSpan target = targetList.get(0);
+		CandidateSpans target = targetList.get(0);
 		targetList.remove(0);			
 		firstSpanPostion = target.getPosition();
 		filterCandidateList(firstSpanPostion);
@@ -107,7 +107,7 @@
 	private boolean isFirstSpanValid() throws IOException{
 		if (candidateList.isEmpty()){
 			if (isFirstSpanInElement()){		
-				setMatchProperties(new CandidateSpan(firstSpans,elementPosition));
+				setMatchProperties(new CandidateSpans(firstSpans,elementPosition));
 				hasMoreSpans = firstSpans.next();
 				return true;
 			}
@@ -137,7 +137,7 @@
 		if (!isOrdered) collectLeftCandidates();
 		
 		if (isFirstSpanInElement()){
-			CandidateSpan target = new CandidateSpan(firstSpans,elementPosition);
+			CandidateSpans target = new CandidateSpans(firstSpans,elementPosition);
 			hasMoreSpans = firstSpans.next();
 			// Checking the secondspans in the left side
 			if (!isOrdered && isWithinDistance()) return false;
@@ -161,14 +161,14 @@
 			if (hasMoreSpans && firstSpans.start() < secondSpans.start() &&
 					firstSpans.doc() == currentDocNum){
 				if (advanceElementTo(firstSpans)){
-					targetList.add(new CandidateSpan(firstSpans, elementPosition));
+					targetList.add(new CandidateSpans(firstSpans, elementPosition));
 				}
 				hasMoreSpans = firstSpans.next();
 				continue;
 			}
 			
 			if (advanceElementTo(secondSpans)){
-				candidateList.add(new CandidateSpan(secondSpans,elementPosition));
+				candidateList.add(new CandidateSpans(secondSpans,elementPosition));
 			}
 			hasMoreSecondSpans = secondSpans.next();
 		}		
@@ -178,7 +178,7 @@
 		while(hasMoreSecondSpans && secondSpans.doc() == firstSpans.doc() &&
 				secondSpans.start() < firstSpans.end()){
 			if (advanceElementTo(secondSpans)){
-				candidateList.add(new CandidateSpan(secondSpans,elementPosition));
+				candidateList.add(new CandidateSpans(secondSpans,elementPosition));
 				filterCandidateList(elementPosition);
 			}
 			hasMoreSecondSpans = secondSpans.next();
@@ -187,7 +187,7 @@
 	
 	private boolean isWithinDistance(){
 		int actualDistance; 
-		for (CandidateSpan cs: candidateList){
+		for (CandidateSpans cs: candidateList){
 			actualDistance = cs.getPosition() - firstSpanPostion;
 			if (!isOrdered) actualDistance = Math.abs(actualDistance);
 			
@@ -208,8 +208,8 @@
 	
 	private void filterCandidateList(int position){
 		
-		Iterator<CandidateSpan> i = candidateList.iterator();
-		CandidateSpan cs;
+		Iterator<CandidateSpans> i = candidateList.iterator();
+		CandidateSpans cs;
 		while(i.hasNext()){
 			cs = i.next();
 			if (cs.getPosition() == position || 
@@ -220,7 +220,7 @@
 		}		
 	}	
 	
-	private void setMatchProperties(CandidateSpan match) throws IOException{
+	private void setMatchProperties(CandidateSpans match) throws IOException{
 		matchDocNumber = match.getDoc();
 		matchStartPosition = match.getStart();
 		matchEndPosition = match.getEnd();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
index 229004e..20c9691 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementDistanceSpans.java
@@ -47,7 +47,7 @@
 
 	@Override
 	protected boolean findMatch() throws IOException {
-		CandidateSpan candidateSpan = candidateList.get(candidateListIndex);
+		CandidateSpans candidateSpan = candidateList.get(candidateListIndex);
 		int actualDistance = secondSpanPostion - candidateSpan.getPosition();
 		
 		// In the same element
@@ -91,7 +91,7 @@
 				firstSpans.start() < secondSpans.end()){
 			
 			if (advanceElementTo(firstSpans)){
-				candidateList.add(new CandidateSpan(firstSpans,elementPosition));				
+				candidateList.add(new CandidateSpans(firstSpans,elementPosition));				
 				filterCandidateList(elementPosition);
 			}
 			hasMoreFirstSpans = firstSpans.next();
@@ -124,8 +124,8 @@
 	 * */
 	private void filterCandidateList(int position){
 		
-		Iterator<CandidateSpan> i = candidateList.iterator();
-		CandidateSpan cs;
+		Iterator<CandidateSpans> i = candidateList.iterator();
+		CandidateSpans cs;
 		while(i.hasNext()){
 			cs = i.next();
 			if (cs.getPosition() == position || 
@@ -150,7 +150,7 @@
 	
 	@Override
 	public long cost() {
-		CandidateSpan candidateSpan = candidateList.get(candidateListIndex);
+		CandidateSpans candidateSpan = candidateList.get(candidateListIndex);
 		return elements.cost() + candidateSpan.getCost() + secondSpans.cost();
 	}
 }
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 30f2b76..bbe9f59 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
@@ -174,7 +174,7 @@
 	
 	/** Match candidate for element spans.
 	 * */	
-	class CandidateElementSpans extends CandidateSpan {
+	class CandidateElementSpans extends CandidateSpans {
 		
 		private short elementRef;
 		
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
index 79c6db4..5cfe210 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
@@ -24,7 +24,7 @@
 	private int min, max;
 	private int direction;
 	private byte classNumber;
-	private List<CandidateSpan> candidateSpans;
+	private List<CandidateSpans> candidateSpans;
 	private boolean hasMoreNotClause;
 	private Spans notClause;
 	
@@ -54,7 +54,7 @@
 		this.notClause = secondSpans;
 		this.hasMoreNotClause = notClause.next();		
 		
-		candidateSpans = new ArrayList<CandidateSpan>();		
+		candidateSpans = new ArrayList<CandidateSpans>();		
 		hasMoreSpans = firstSpans.next();
 	}
 
@@ -69,7 +69,7 @@
 		while (hasMoreSpans || candidateSpans.size() > 0){
 			if (candidateSpans.size() > 0){
 				// set a candidate span as a match
-				CandidateSpan cs = candidateSpans.get(0);
+				CandidateSpans cs = candidateSpans.get(0);
 				matchDocNumber = cs.getDoc();
 				matchStartPosition = cs.getStart();
 				matchEndPosition = cs.getEnd();
@@ -103,14 +103,14 @@
 	private void expandLeft() throws IOException{
 		//int counter = max;
 		int maxPos = max;
-		CandidateSpan lastNotClause = null;
+		CandidateSpans lastNotClause = null;
 		while (hasMoreNotClause && 
 				notClause.start() < firstSpans.start()){
 			
 			// between max and firstspan.start()
 			if (notClause.start() >= firstSpans.start() - maxPos){
 				maxPos = firstSpans.start() - notClause.start() -1;
-				lastNotClause = new CandidateSpan(notClause);
+				lastNotClause = new CandidateSpans(notClause);
 				//counter--;
 			} 
 			if (!notClause.next()) hasMoreNotClause = false;
@@ -140,13 +140,13 @@
 		int maxPos = max;
 		boolean isFound = false;
 		
-		CandidateSpan firstNotClause = null;
+		CandidateSpans firstNotClause = null;
 		//System.out.println("main start:"+firstSpans.start());
 		while (hasMoreNotClause && notClause.start() < expansionEnd){
 			// between firstspan.end() and expansionEnd
 			if (!isFound && notClause.start() >= firstSpans.end()){							
 				maxPos = notClause.start() - firstSpans.end() -1;
-				firstNotClause = new CandidateSpan(notClause);
+				firstNotClause = new CandidateSpans(notClause);
 				isFound = true;
 			}						
 			if (!notClause.next()) hasMoreNotClause = false;
@@ -173,7 +173,7 @@
 			throws IOException {
 		int counter;
 		int start, end;
-		CandidateSpan cs;
+		CandidateSpans cs;
 		if (direction < 0 ) { // left
 			counter = maxPos;
 			while (counter >= min){
@@ -181,7 +181,7 @@
 				if (start > -1 ){					
 					end = firstSpans.end();
 					//System.out.println(start+","+end);
-					cs = new CandidateSpan(start, end, firstSpans.doc(),
+					cs = new CandidateSpans(start, end, firstSpans.doc(),
 							firstSpans.cost(), 
 							calculatePayload(start,firstSpans.start())
 					);
@@ -197,7 +197,7 @@
 				end = firstSpans.end() + counter;
 				//System.out.println(start+","+end);
 				
-				cs = new CandidateSpan(start, end, firstSpans.doc(), 
+				cs = new CandidateSpans(start, end, firstSpans.doc(), 
 						firstSpans.cost(), 
 						calculatePayload(firstSpans.end(), end)
 				);				
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
index 1f039cd..245df4d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
@@ -21,7 +21,7 @@
 	private int min, max;
 	private byte classNumber;
 	private int direction;	
-	private List<CandidateSpan> candidateSpans;
+	private List<CandidateSpans> candidateSpans;
 	private long matchCost;
 	
 	public ExpandedSpans(SpanExpansionQuery spanExpansionQuery,
@@ -33,7 +33,7 @@
 		this.direction = spanExpansionQuery.getDirection();
 		this.classNumber = spanExpansionQuery.getClassNumber();
 		
-		candidateSpans = new ArrayList<CandidateSpan>();		
+		candidateSpans = new ArrayList<CandidateSpans>();		
 		hasMoreSpans = true;		
 	}
 
@@ -57,14 +57,14 @@
 	}
 	
 	private void setCandidateList() throws IOException {
-		CandidateSpan cs;
+		CandidateSpans cs;
 		int counter, start, end;
 		
 		if (direction < 0 ){
 			counter = max;
 			while (counter >= min ){
 				start =  Math.max(0,firstSpans.start() - counter);			
-				cs = new CandidateSpan(
+				cs = new CandidateSpans(
 						start, 
 						firstSpans.end(), 
 						firstSpans.doc(), 
@@ -81,7 +81,7 @@
 			while (counter <= max){
 				// TODO: How do I know if the end is already too far (over the end of the doc)? 
 				end = firstSpans.end() + counter;
-				cs = new CandidateSpan(
+				cs = new CandidateSpans(
 						firstSpans.start(), 
 						end, 
 						firstSpans.doc(), 
@@ -116,7 +116,7 @@
 		return buffer.array();
 	}
 
-	private void setMatch(CandidateSpan candidateSpan) {
+	private void setMatch(CandidateSpans candidateSpan) {
 		matchDocNumber = candidateSpan.getDoc();
 		matchStartPosition = candidateSpan.getStart();
 		matchEndPosition = candidateSpan.getEnd();			
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
index 997ab09..ef149c3 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/MultipleDistanceSpans.java
@@ -94,11 +94,11 @@
 	 * */	
 	protected boolean findMatch() throws IOException {
 		 		
-		CandidateSpan xf = x.getMatchFirstSpan();
-		CandidateSpan xs = x.getMatchSecondSpan();
+		CandidateSpans xf = x.getMatchFirstSpan();
+		CandidateSpans xs = x.getMatchSecondSpan();
 		
-		CandidateSpan yf = y.getMatchFirstSpan();
-		CandidateSpan ys = y.getMatchSecondSpan();
+		CandidateSpans yf = y.getMatchFirstSpan();
+		CandidateSpans ys = y.getMatchSecondSpan();
 		
 		if (x.isExclusion() || y.isExclusion()){			
 			if (xf.getStart() == yf.getStart() && xf.getEnd() == yf.getEnd()){
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 4936eaa..bfa1579 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
@@ -24,8 +24,8 @@
  * */
 public class NextSpans extends SimpleSpans {	
 	
-	private List<CandidateSpan> matchList;
-	private List<CandidateSpan> candidateList;
+	private List<CandidateSpans> matchList;
+	private List<CandidateSpans> candidateList;
 	private int candidateListDocNum;
 	private boolean hasMoreFirstSpan;
 	
@@ -95,8 +95,8 @@
 	}
 	
 	private void searchCandidates() throws IOException {
-		Iterator<CandidateSpan> i = candidateList.iterator();
-		CandidateSpan cs;
+		Iterator<CandidateSpans> i = candidateList.iterator();
+		CandidateSpans cs;
 		while(i.hasNext()){
 			cs = i.next();
 			if (cs.getStart() == firstSpans.end()){
@@ -117,14 +117,14 @@
 				break;
 			}
 			if (secondSpans.start() == firstSpans.end()){
-				candidateList.add(new CandidateSpan(secondSpans));
-				addMatch(new CandidateSpan(secondSpans));
+				candidateList.add(new CandidateSpans(secondSpans));
+				addMatch(new CandidateSpans(secondSpans));
 			}
 			hasMoreSpans = secondSpans.next();
 		}
 	}
 	
-	private void addMatch(CandidateSpan cs) throws IOException{
+	private void addMatch(CandidateSpans cs) throws IOException{
 		
 		int start = firstSpans.start();
 		long cost = firstSpans.cost() + cs.getCost();
@@ -137,7 +137,7 @@
 				payloads.addAll(cs.getPayloads());
 		}	
 		
-		matchList.add(new CandidateSpan(start,cs.getEnd(),candidateListDocNum,cost,
+		matchList.add(new CandidateSpans(start,cs.getEnd(),candidateListDocNum,cost,
 				payloads));
 	}
 
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 1dd1a04..bdf81ef 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
@@ -22,7 +22,7 @@
 	protected boolean hasMoreFirstSpans;	
 	protected int minDistance,maxDistance;
 	
-	protected List<CandidateSpan> candidateList;
+	protected List<CandidateSpans> candidateList;
 	protected int candidateListIndex;
 	protected int candidateListDocNum;
 	
@@ -84,11 +84,11 @@
 	
 	/** Define the properties of a span match.
 	 * */
-	protected void setMatchProperties(CandidateSpan candidateSpan, 
+	protected void setMatchProperties(CandidateSpans candidateSpan, 
 			boolean isDistanceZero) throws IOException{
 		
 		setMatchFirstSpan(candidateSpan);
-		setMatchSecondSpan(new CandidateSpan(secondSpans));
+		setMatchSecondSpan(new CandidateSpans(secondSpans));
 		
 		if (isDistanceZero){
 			matchStartPosition = Math.min(candidateSpan.getStart(), secondSpans.start());
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpansWithVariable.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
similarity index 94%
rename from src/main/java/de/ids_mannheim/korap/query/spans/RelationSpansWithVariable.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
index 871f45a..228c0ef 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpansWithVariable.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationPartSpans.java
@@ -11,10 +11,10 @@
 import org.apache.lucene.index.TermContext;
 import org.apache.lucene.util.Bits;
 
-import de.ids_mannheim.korap.query.SpanRelationWithVariableQuery;
+import de.ids_mannheim.korap.query.SpanRelationPartQuery;
 
-/** This span enumeration returns the right side of relation spans 
- * 	whose left side token/element positions matching the second spans, 
+/** This span enumeration returns the right part of relation spans 
+ * 	whose left part token/element positions matching the second spans, 
  * 	or vice versa.
  * 	
  * 	Relations within a certain window, e.g element-based or token-
@@ -23,7 +23,7 @@
  * 
  * 	@author margaretha
  * */
-public class RelationSpansWithVariable extends SpansWithId{
+public class RelationPartSpans extends SpansWithId{
 	
 	private RelationSpans relationSpans;
 	private SpansWithId matcheeSpans;
@@ -36,7 +36,7 @@
 	private short leftId, rightId;
 	private int window;
 	
-	public RelationSpansWithVariable(SpanRelationWithVariableQuery query,	
+	public RelationPartSpans(SpanRelationPartQuery query,	
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts) throws IOException {
 		super(query, context, acceptDocs, termContexts);
@@ -235,7 +235,7 @@
 		this.rightId = rightId;
 	}
 
-	class CandidateRelationSpan extends CandidateSpan implements Comparable<CandidateSpan>{
+	class CandidateRelationSpan extends CandidateSpans implements Comparable<CandidateSpans>{
 		
 		private int rightStart, rightEnd; 
 		private short leftId, rightId;
@@ -252,7 +252,7 @@
 		}
 		
 		@Override
-		public int compareTo(CandidateSpan o) {
+		public int compareTo(CandidateSpans o) {
 			CandidateRelationSpan cs = (CandidateRelationSpan) o;
 			if (sortRight)
 				return sortByRight(cs);
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 5e3c0b7..f026994 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
@@ -203,7 +203,7 @@
 
 
 
-	class CandidateRelationSpan extends CandidateSpan implements Comparable<CandidateSpan>{
+	class CandidateRelationSpan extends CandidateSpans implements Comparable<CandidateSpans>{
 		
 		private int rightStart, rightEnd;
 		private short leftId, rightId;
@@ -213,7 +213,7 @@
 		}
 
 		@Override
-		public int compareTo(CandidateSpan o) {
+		public int compareTo(CandidateSpans o) {
 
 			int sourcePositionComparison = super.compareTo(o);
 			
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
index 8ece0f8..8303956 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
@@ -25,7 +25,7 @@
 	
 	private int min,max;
 	private long matchCost;
-	private List<CandidateSpan> matchList;
+	private List<CandidateSpans> matchList;
 	private Logger log = LoggerFactory.getLogger(RepetitionSpans.class);
     // This advices the java compiler to ignore all loggings
     public static final boolean DEBUG = false;
@@ -38,7 +38,7 @@
 		super(query, context, acceptDocs, termContexts);
 		this.min = query.getMin();
 		this.max = query.getMax();
-		matchList = new ArrayList<CandidateSpan>();
+		matchList = new ArrayList<CandidateSpans>();
 		hasMoreSpans = firstSpans.next();
 	}
 
@@ -62,7 +62,7 @@
 			matchPayload.clear();
 			matchCost = 0;
 			
-			List<CandidateSpan> adjacentSpans = collectAdjacentSpans();
+			List<CandidateSpans> adjacentSpans = collectAdjacentSpans();
 			setMatchList(adjacentSpans);
 		}	
 		return false;
@@ -71,14 +71,14 @@
 	/** Collect all adjacent spans occurring in a sequence.
 	 * 	@return a list of the adjacent spans 
 	 * */
-	private List<CandidateSpan> collectAdjacentSpans() throws IOException {
+	private List<CandidateSpans> collectAdjacentSpans() throws IOException {
 		
-		CandidateSpan startSpan = new CandidateSpan(firstSpans);
+		CandidateSpans startSpan = new CandidateSpans(firstSpans);
 		
-		List<CandidateSpan> adjacentSpans = new ArrayList<CandidateSpan>();
+		List<CandidateSpans> adjacentSpans = new ArrayList<CandidateSpans>();
 		adjacentSpans.add(startSpan);
 		
-		CandidateSpan prevSpan = startSpan;
+		CandidateSpans prevSpan = startSpan;
 		
 		while ((hasMoreSpans = firstSpans.next()) &&
 			startSpan.getDoc() == firstSpans.doc() ){
@@ -87,7 +87,7 @@
 				break;
 			}
 			else {
-				prevSpan = new CandidateSpan(firstSpans);
+				prevSpan = new CandidateSpans(firstSpans);
 				adjacentSpans.add(prevSpan);
 			}
 		}		
@@ -97,8 +97,8 @@
 	/** Generate all possible repetition candidate spans from the adjacent spans 
 	 * 	and add them to the match list. 
 	 * */
-	private void setMatchList(List<CandidateSpan> adjacentSpans){
-		CandidateSpan startSpan, endSpan, matchSpan;
+	private void setMatchList(List<CandidateSpans> adjacentSpans){
+		CandidateSpans startSpan, endSpan, matchSpan;
 		for (int i=min; i<max+1; i++){
 			//System.out.println("num: "+i);			
 			int j=0; 
@@ -110,7 +110,7 @@
 				}
 				else {
 					endSpan = adjacentSpans.get(endIndex);														
-					matchSpan = new CandidateSpan(
+					matchSpan = new CandidateSpans(
 							startSpan.getStart(), 
 							endSpan.getEnd(), 
 							startSpan.getDoc(), 
@@ -132,7 +132,7 @@
 	/** Add all the payloads of a candidate span
 	 * */
 	private Collection<byte[]> computeMatchPayload(
-			List<CandidateSpan> adjacentSpans, int start, int end) {
+			List<CandidateSpans> adjacentSpans, int start, int end) {
 		Collection<byte[]> payload = new ArrayList<byte[]>();
 		for (int i=start; i<= end; i++){
 			payload.addAll(adjacentSpans.get(i).getPayloads());
@@ -142,7 +142,7 @@
 
 	/** Add all the cost of a candidate span
 	 * */
-	private long computeMatchCost(List<CandidateSpan> adjacentSpans, 
+	private long computeMatchCost(List<CandidateSpans> adjacentSpans, 
 			int start, int end){		
 		long matchCost = 0;
 		for (int i=start; i<= end; i++){
@@ -154,7 +154,7 @@
 	
 	/** Setting match properties from the candidate span
 	 * */	
-	private void setMatchProperties(CandidateSpan candidateSpan) 
+	private void setMatchProperties(CandidateSpans candidateSpan) 
 			throws IOException {
 	    matchDocNumber = candidateSpan.getDoc();
 	    matchStartPosition = candidateSpan.getStart();
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 f3c4907..3b63d88 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
@@ -48,8 +48,8 @@
 	 * 	from the candidate list prepared for the previous second spans. 
 	 * */
 	private void copyPossibleCandidates(){
-		List<CandidateSpan> temp = new ArrayList<>();
-		for (CandidateSpan cs : candidateList){
+		List<CandidateSpans> temp = new ArrayList<>();
+		for (CandidateSpans cs : candidateList){
 			if (cs.getEnd()+maxDistance > secondSpans.start())
 				temp.add(cs);
 		}
@@ -64,7 +64,7 @@
 				firstSpans.start() < secondSpans.end()){
 			
 			if (firstSpans.end()+maxDistance > secondSpans.start())
-				candidateList.add(new CandidateSpan(firstSpans));
+				candidateList.add(new CandidateSpans(firstSpans));
 			
 			hasMoreFirstSpans = firstSpans.next();
 		}
@@ -72,7 +72,7 @@
 	
 	@Override
 	protected boolean findMatch() throws IOException {
-		CandidateSpan candidateSpan = candidateList.get(candidateListIndex);		
+		CandidateSpans candidateSpan = candidateList.get(candidateListIndex);		
 		if (minDistance == 0 &&
 				// intersection
 				candidateSpan.getStart() < secondSpans.end() && 
@@ -95,7 +95,7 @@
 	
 	@Override
 	public long cost() {
-		CandidateSpan candidateSpan = candidateList.get(candidateListIndex);
+		CandidateSpans candidateSpan = candidateList.get(candidateListIndex);
 		return candidateSpan.getCost() + secondSpans.cost();
 	}
 
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 7934f34..9d0aa65 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
@@ -24,8 +24,8 @@
 
 	protected int minDistance, maxDistance;
 	protected boolean hasMoreFirstSpans, hasMoreSecondSpans;
-	protected List<CandidateSpan> firstSpanList, secondSpanList;	
-	protected List<CandidateSpan> matchList;
+	protected List<CandidateSpans> firstSpanList, secondSpanList;	
+	protected List<CandidateSpans> matchList;
 	private long matchCost;
 	private int matchListSpanNum; 	
 	protected int currentDocNum;
@@ -40,9 +40,9 @@
 		minDistance = query.getMinDistance();
 		maxDistance =  query.getMaxDistance();
 		
-		firstSpanList = new ArrayList<CandidateSpan>();
-		secondSpanList = new ArrayList<CandidateSpan>();
-		matchList = new ArrayList<CandidateSpan>();
+		firstSpanList = new ArrayList<CandidateSpans>();
+		secondSpanList = new ArrayList<CandidateSpans>();
+		matchList = new ArrayList<CandidateSpans>();
 		
 		hasMoreFirstSpans = firstSpans.next();
 		hasMoreSecondSpans = secondSpans.next();
@@ -90,7 +90,7 @@
 //			System.out.println(cs.getStart() +" "+ cs.getEnd());
 //		}
 		
-		CandidateSpan currentFirstSpan, currentSecondSpan;
+		CandidateSpans currentFirstSpan, currentSecondSpan;
 		if (!firstSpanList.isEmpty() && !secondSpanList.isEmpty()){
 			
 			currentFirstSpan = firstSpanList.get(0)	;
@@ -140,7 +140,7 @@
 		}
 	}
 	
-	private boolean isLastCandidateSmaller(CandidateSpan currentFirstSpan, CandidateSpan 
+	private boolean isLastCandidateSmaller(CandidateSpans currentFirstSpan, CandidateSpans 
 			currentSecondSpan){
 		if (currentFirstSpan.getEnd() == currentSecondSpan.getEnd() ){
 			int secondEnd = secondSpanList.get(secondSpanList.size()-1).getEnd();
@@ -151,29 +151,29 @@
 		return false;
 	}
 	
-	protected abstract void updateList(List<CandidateSpan> candidateList);
+	protected abstract void updateList(List<CandidateSpans> candidateList);
 	
 	/** Set the candidate list for the first element in the target list.
 	 * @return true iff the spans enumeration still has a next element 
 	 * to be a candidate
 	 */
-	protected abstract boolean setCandidateList(List<CandidateSpan> 
+	protected abstract boolean setCandidateList(List<CandidateSpans> 
 			candidateList, Spans candidate, boolean hasMoreCandidates,
-			List<CandidateSpan> targetList) throws IOException;
+			List<CandidateSpans> targetList) throws IOException;
 	
 	/** Search all matches between the target span and its candidates in the candidate 
 	 * 	list.
 	 * 	@return the matches in a list 
 	 * */
-	protected abstract List<CandidateSpan> findMatches(CandidateSpan target, 
-			List<CandidateSpan> candidateList);
+	protected abstract List<CandidateSpans> findMatches(CandidateSpans target, 
+			List<CandidateSpans> candidateList);
 	
 	/** Compute match properties and create a candidate span match 
 	 * 	to be added to the match list.
 	 * 	@return a candidate span match 
 	 * */
-	protected CandidateSpan createMatchCandidate(CandidateSpan target,
-			CandidateSpan cs, boolean isDistanceZero) {
+	protected CandidateSpans createMatchCandidate(CandidateSpans target,
+			CandidateSpans cs, boolean isDistanceZero) {
 		
 		int start = Math.min(target.getStart(), cs.getStart());
 		int end = Math.max(target.getEnd(),cs.getEnd());
@@ -190,7 +190,7 @@
 			}
 		}
 		
-		CandidateSpan match = new CandidateSpan(start,end,doc,cost,payloads);
+		CandidateSpans match = new CandidateSpans(start,end,doc,cost,payloads);
 		match.setChildSpan(cs);
 		return match;
 	}
@@ -198,7 +198,7 @@
 	/** Assign the first candidate span in the match list as the current span match.
 	 * */
 	private void setMatchProperties() {
-		CandidateSpan cs = matchList.get(0);
+		CandidateSpans cs = matchList.get(0);
 		matchDocNumber = cs.getDoc();
 		matchStartPosition = cs.getStart();
 		matchEndPosition = cs.getEnd();
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 a0c4474..4a90575 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
@@ -29,7 +29,7 @@
 	
 	// contains all previous elements whose position is greater than the last 
 	// target span
-	private List<CandidateSpan> elementList;
+	private List<CandidateSpans> elementList;
 	
 	public UnorderedElementDistanceSpans(SpanDistanceQuery query,
 			AtomicReaderContext context, Bits acceptDocs,
@@ -39,7 +39,7 @@
 	  			getSpans(context, acceptDocs, termContexts);	  		
   		hasMoreElements = elements.next();  		
   		elementPosition=0;  		
-  		elementList = new ArrayList<CandidateSpan>();  		
+  		elementList = new ArrayList<CandidateSpans>();  		
 	}
 	
 	@Override
@@ -74,13 +74,13 @@
 		return true;
 	}
 	
-	private boolean addSpan(Spans span, List<CandidateSpan> list, boolean hasMoreSpan) 
+	private boolean addSpan(Spans span, List<CandidateSpans> list, boolean hasMoreSpan) 
 			throws IOException {
 		int position;
 		while (hasMoreSpan && span.doc() == currentDocNum){
 			position = findElementPosition(span);
 			if (position != -1){
-				list.add(new CandidateSpan(span,position));
+				list.add(new CandidateSpans(span,position));
 				hasMoreSpan = span.next();
 				return hasMoreSpan;
 			}
@@ -100,7 +100,7 @@
 		if (!elementList.isEmpty() && 
 				span.end() <= elementList.get(elementList.size()-1).getEnd()){
 			
-			for (CandidateSpan e : elementList)
+			for (CandidateSpans e : elementList)
 				if (e.getEnd() >= span.end() && e.getStart() <= span.start()){
 					return e.getPosition();
 				}
@@ -124,7 +124,7 @@
 					span.end() <= elements.end()){
 				return true;
 			}
-			elementList.add(new CandidateSpan(elements,elementPosition));
+			elementList.add(new CandidateSpans(elements,elementPosition));
 			hasMoreElements = elements.next();
 			elementPosition++;			
 		}
@@ -133,18 +133,18 @@
 	}
 
 	@Override
-	protected boolean setCandidateList(List<CandidateSpan> 
+	protected boolean setCandidateList(List<CandidateSpans> 
 			candidateList, Spans candidate, boolean hasMoreCandidates,
-			List<CandidateSpan> targetList) throws IOException {
+			List<CandidateSpans> targetList) throws IOException {
 		 
 		if (!targetList.isEmpty()){			
-			CandidateSpan cs;
-			CandidateSpan target = targetList.get(0);
+			CandidateSpans cs;
+			CandidateSpans target = targetList.get(0);
 			int position;
 			while (hasMoreCandidates && candidate.doc() == target.getDoc()){
 				position = findElementPosition(candidate); 
 				if (position != -1){
-					cs = new CandidateSpan(candidate,position);
+					cs = new CandidateSpans(candidate,position);
 					
 					if (isWithinMaxDistance(target, cs)){
 						candidateList.add(cs);						
@@ -162,7 +162,7 @@
 	 *  @return true iff the target and candidate spans are within the maximum
 	 *  distance
 	 * */
-	protected boolean isWithinMaxDistance(CandidateSpan target, CandidateSpan candidate) {
+	protected boolean isWithinMaxDistance(CandidateSpans target, CandidateSpans candidate) {
 		int candidatePos = candidate.getPosition();
 		int targetPos = target.getPosition();
 		
@@ -180,15 +180,15 @@
 	}
 	
 	@Override
-	protected List<CandidateSpan> findMatches(CandidateSpan target, List<CandidateSpan> 
+	protected List<CandidateSpans> findMatches(CandidateSpans target, List<CandidateSpans> 
 			candidateList) {
 		
-		List<CandidateSpan> matches = new ArrayList<>();
+		List<CandidateSpans> matches = new ArrayList<>();
 		
 		int actualDistance;
 		int targetPos = target.getPosition();		
 		
-		for (CandidateSpan cs : candidateList){						
+		for (CandidateSpans cs : candidateList){						
 			actualDistance = Math.abs( targetPos - cs.getPosition() );
 			
 			if (minDistance == 0 && actualDistance == 0){
@@ -203,7 +203,7 @@
 	}
 
 	@Override
-	protected void updateList(List<CandidateSpan> candidateList) {
+	protected void updateList(List<CandidateSpans> candidateList) {
 		updateElementList(candidateList.get(0).getPosition());
 		candidateList.remove(0);
 	}
@@ -213,8 +213,8 @@
 	 * 	span.
 	 * */
 	private void updateElementList(int position){
-		Iterator<CandidateSpan> i = elementList.iterator();
-		CandidateSpan e;
+		Iterator<CandidateSpans> i = elementList.iterator();
+		CandidateSpans e;
 		while(i.hasNext()){
 			e = i.next();			
 			if (e.getPosition() <= position) {
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 5f1abd9..91ef11a 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
@@ -33,8 +33,8 @@
 		if (firstSpanList.isEmpty() && secondSpanList.isEmpty()){
 			if (hasMoreFirstSpans && hasMoreSecondSpans &&
 					ensureSameDoc(firstSpans, secondSpans)){			
-				firstSpanList.add(new CandidateSpan(firstSpans));
-				secondSpanList.add(new CandidateSpan(secondSpans));
+				firstSpanList.add(new CandidateSpans(firstSpans));
+				secondSpanList.add(new CandidateSpans(secondSpans));
 				currentDocNum = firstSpans.doc();
 				hasMoreFirstSpans = firstSpans.next();
 				hasMoreSecondSpans = secondSpans.next();				
@@ -46,27 +46,27 @@
 		}
 		else if (firstSpanList.isEmpty() && hasMoreFirstSpans && 
 				firstSpans.doc() == currentDocNum){
-			firstSpanList.add(new CandidateSpan(firstSpans));
+			firstSpanList.add(new CandidateSpans(firstSpans));
 			hasMoreFirstSpans = firstSpans.next();
 		}
 		else if (secondSpanList.isEmpty() && hasMoreSecondSpans && 
 				secondSpans.doc() == currentDocNum){
-			secondSpanList.add(new CandidateSpan(secondSpans));
+			secondSpanList.add(new CandidateSpans(secondSpans));
 			hasMoreSecondSpans = secondSpans.next();
 		}
 		return true;
 	}
 	
 	@Override
-	protected boolean setCandidateList(List<CandidateSpan> 
+	protected boolean setCandidateList(List<CandidateSpans> 
 			candidateList, Spans candidate, boolean hasMoreCandidates,
-			List<CandidateSpan> targetList) throws IOException {
+			List<CandidateSpans> targetList) throws IOException {
 		
 		if (!targetList.isEmpty()){
-			CandidateSpan target = targetList.get(0);
+			CandidateSpans target = targetList.get(0);
 			while (hasMoreCandidates && candidate.doc() == target.getDoc()
 					&& isWithinMaxDistance(target,candidate)){
-				candidateList.add(new CandidateSpan(candidate));
+				candidateList.add(new CandidateSpans(candidate));
 				hasMoreCandidates = candidate.next();
 			}
 		}
@@ -77,7 +77,7 @@
 	 *  @return true iff the target and candidate spans are within the maximum
 	 *  distance
 	 * */
-	protected boolean isWithinMaxDistance(CandidateSpan target, Spans candidate) {
+	protected boolean isWithinMaxDistance(CandidateSpans target, Spans candidate) {
 		// left candidate
 		if (candidate.end() < target.getStart() && 
 				candidate.end() + maxDistance <= target.getStart()){
@@ -92,12 +92,12 @@
 	}
 	
 	@Override	
-	protected List<CandidateSpan> findMatches(CandidateSpan target, List<CandidateSpan> 
+	protected List<CandidateSpans> findMatches(CandidateSpans target, List<CandidateSpans> 
 			candidateList) {
 		
-		List<CandidateSpan> matches = new ArrayList<>();		
+		List<CandidateSpans> matches = new ArrayList<>();		
 		int actualDistance;
-		for (CandidateSpan cs : candidateList){
+		for (CandidateSpans cs : candidateList){
 			if (minDistance == 0 &&
 					//intersection
 					target.getStart() < cs.getEnd() &&
@@ -119,7 +119,7 @@
 	}
 
 	@Override
-	protected void updateList(List<CandidateSpan> candidateList) {
+	protected void updateList(List<CandidateSpans> candidateList) {
 		candidateList.remove(0);		
 	}
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
index 74483b3..a693858 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
@@ -14,7 +14,7 @@
 import de.ids_mannheim.korap.query.SpanAttributeQuery;
 import de.ids_mannheim.korap.query.SpanElementQuery;
 import de.ids_mannheim.korap.query.SpanRelationQuery;
-import de.ids_mannheim.korap.query.SpanRelationWithVariableQuery;
+import de.ids_mannheim.korap.query.SpanRelationPartQuery;
 import de.ids_mannheim.korap.query.SpanSegmentQuery;
 import de.ids_mannheim.korap.query.SpanTermWithIdQuery;
 import de.ids_mannheim.korap.query.SpanWithAttributeQuery;
@@ -345,7 +345,7 @@
 		ki.commit();
 		
 		//return all children of np
-		SpanRelationWithVariableQuery rv = new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv = new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:child-of")),true
 				), 
@@ -400,7 +400,7 @@
 		);
 		
 		//return all children of np
-		SpanRelationWithVariableQuery rv =new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv =new SpanRelationPartQuery(
 				spanRelationQuery, 
 				new SpanElementQuery("base","np"), 
 				false, true);
@@ -441,7 +441,7 @@
 		);
 		
 		//return all parents of np
-		SpanRelationWithVariableQuery rv =new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv =new SpanRelationPartQuery(
 				spanRelationQuery, 
 				new SpanElementQuery("base","np"), 
 				true, true);
@@ -472,7 +472,7 @@
 		ki.commit();
 		
 		//return all parents of np
-		SpanRelationWithVariableQuery rv =new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:child-of")),true
 				), 
@@ -495,7 +495,7 @@
 		// id problem (solved)
 		
 		// return all children of relation targets/ right side		
-		SpanRelationWithVariableQuery rv3 = new SpanRelationWithVariableQuery(				
+		SpanRelationPartQuery rv3 = new SpanRelationPartQuery(				
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:child-of")),true
 				),
@@ -521,7 +521,7 @@
 		// match right
 		
 		//return source of dep relations to pos:NN
-		SpanRelationWithVariableQuery rv =new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:dep")),true
 				), 
@@ -537,7 +537,7 @@
 		assertEquals(5,kr.getMatch(2).getEndPos());
 		
 		//return target of dep relations from pos:NN
-		rv =new SpanRelationWithVariableQuery(
+		rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base","<:dep")),true
 				), 
@@ -555,7 +555,7 @@
 		// matchleft
 		
 		//return target of dep relations from pos:NN
-		rv =new SpanRelationWithVariableQuery(
+		rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:dep")),true
 				), 
@@ -572,7 +572,7 @@
 		assertEquals(6,kr.getMatch(2).getEndPos());
 		
 		//return source of dep relations to pos:NN		
-		rv =new SpanRelationWithVariableQuery(
+		rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base","<:dep")),true
 				), 
@@ -601,7 +601,7 @@
 		ki.addDoc(createFieldDoc2());
 		ki.commit();
 				
-		SpanRelationWithVariableQuery rv = new SpanRelationWithVariableQuery(
+		SpanRelationPartQuery rv = new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base",">:child-of")),true
 				), 
@@ -611,7 +611,7 @@
 		kr = ki.search(rv,(short) 10);
 		assertEquals(7, kr.getTotalResults());
 		
-		rv =new SpanRelationWithVariableQuery(
+		rv =new SpanRelationPartQuery(
 				new SpanRelationQuery(
 						new SpanTermQuery(new Term("base","<:dep")),true
 				),