diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index 6343456..b22f2fc 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -881,6 +881,7 @@
     };
 
 
+    @Deprecated
     public HashMap getTermRelation (String field) throws Exception {
 	return this.getTermRelation(new KorapCollection(this), field);
     };
@@ -889,6 +890,7 @@
     /**
      * Analyze how terms relate
      */
+    @Deprecated
     public HashMap getTermRelation (KorapCollection kc, String field) throws Exception {
 	HashMap<String,Long> map = new HashMap<>(100);
 	long docNumber = 0, checkNumber = 0;
diff --git a/src/main/java/de/ids_mannheim/korap/KorapMatch.java b/src/main/java/de/ids_mannheim/korap/KorapMatch.java
index 78267a2..d46fa0e 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapMatch.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapMatch.java
@@ -90,7 +90,7 @@
 	           snippetBrackets,
 	           identifier;
 
-    private HighlightCombinator snippetStack;
+    private HighlightCombinator snippetArray;
 
     public boolean startMore = true,
 	           endMore = true;
@@ -924,7 +924,7 @@
 
 	int pos = 0, oldPos = 0;
 
-	this.snippetStack = new HighlightCombinator();
+	this.snippetArray = new HighlightCombinator();
 
 	for (int[] element : stack) {
 	    pos = element[3] != 0 ? element[0] : element[1];
@@ -935,21 +935,21 @@
 		pos = clean.length() - 1;
 	      };
 
-		snippetStack.addString(clean.substring(oldPos, pos));
+		snippetArray.addString(clean.substring(oldPos, pos));
 
 		oldPos = pos;
 	    };
 
 	    if (element[3] != 0) {
-		snippetStack.addOpen(element[2]);
+		snippetArray.addOpen(element[2]);
 	    }
 	    else {
-		snippetStack.addClose(element[2]);
+		snippetArray.addClose(element[2]);
 	    };
 	};
 
 	if (clean.length() > pos) {
-	    snippetStack.addString(clean.substring(pos));
+	    snippetArray.addString(clean.substring(pos));
 	};
     };
 
@@ -974,42 +974,52 @@
 
 	// Snippet stack sizes
 	short start = (short) 0;
-	short end = this.snippetStack.size();
+	short end = this.snippetArray.size();
+	end--;
 
+	// Set levels for highlights 
 	FixedBitSet level = new FixedBitSet(16);
 	level.set(0, 15);
 	byte[] levelCache = new byte[16];
 
-	// Get the first elem
-	HighlightCombinatorElement elem = this.snippetStack.getFirst();
+	// First element of sorted array
+	HighlightCombinatorElement elem = this.snippetArray.getFirst();
 
 	// Create context
 	sb.append("<span class=\"context-left\">");
-	if (startMore)
+	if (this.startMore)
 	    sb.append("<span class=\"more\"></span>");
 
+	// First element is textual
 	if (elem.type == 0) {
 	    sb.append(elem.toHTML(this, level, levelCache));
+	    // Move start position
 	    start++;
 	};
 	sb.append("</span>");
 
-	elem = this.snippetStack.getLast();
+	// Last element of sorted array
+	elem = this.snippetArray.getLast();
 
 	StringBuilder rightContext = new StringBuilder();
 
-	// Create context, if trhere is any
+	// Create right context, if there is any
 	rightContext.append("<span class=\"context-right\">");
+
+	// Last element is textual
 	if (elem != null && elem.type == 0) {
 	    rightContext.append(elem.toHTML(this, level, levelCache));
+
+	    // decrement end
 	    end--;
 	};
-	if (endMore)
+	if (this.endMore)
 	    rightContext.append("<span class=\"more\"></span>");
 	rightContext.append("</span>");
 
-	for (short i = start; i < end; i++) {
-	    sb.append(this.snippetStack.get(i).toHTML(this, level,levelCache));
+	// Iterate through all remaining elements
+	for (short i = start; i <= end; i++) {
+	    sb.append(this.snippetArray.get(i).toHTML(this, level,levelCache));
 	};
 
 	sb.append(rightContext);
@@ -1033,14 +1043,14 @@
 
 	StringBuilder sb = new StringBuilder();
 
-	if (startMore)
+	if (this.startMore)
 	    sb.append("... ");
 
-	for (HighlightCombinatorElement hce : this.snippetStack.stack()) {
+	for (HighlightCombinatorElement hce : this.snippetArray.list()) {
 	    sb.append(hce.toBrackets(this));
 	};
 
-	if (endMore)
+	if (this.endMore)
 	    sb.append(" ...");
 
 	return (this.snippetBrackets = sb.toString());
diff --git a/src/main/java/de/ids_mannheim/korap/match/HighlightCombinator.java b/src/main/java/de/ids_mannheim/korap/match/HighlightCombinator.java
index 4cff483..d379d94 100644
--- a/src/main/java/de/ids_mannheim/korap/match/HighlightCombinator.java
+++ b/src/main/java/de/ids_mannheim/korap/match/HighlightCombinator.java
@@ -13,24 +13,23 @@
 */
 public class HighlightCombinator {
 
-    // Logger
+    // Logger (use the KorapMatch class)
     private final static Logger log = LoggerFactory.getLogger(KorapMatch.class);
 
     // This advices the java compiler to ignore all loggings
     public static final boolean DEBUG = false;
 
-
     private LinkedList<HighlightCombinatorElement> combine;
-    private LinkedList<Integer> balanceStack = new LinkedList<>();
-    private ArrayList<Integer> tempStack = new ArrayList<>(32);
+    private Stack<Integer> balanceStack = new Stack<>();
+    private Stack<Integer> tempStack    = new Stack<>();
 
     // Empty constructor
     public HighlightCombinator () {
 	this.combine = new LinkedList<>();
     };
 
-    // Return the combination stack
-    public LinkedList<HighlightCombinatorElement> stack () {
+    // Return the combination list
+    public LinkedList<HighlightCombinatorElement> list () {
 	return this.combine;
     };
 
@@ -49,7 +48,7 @@
 	return this.combine.get(index);
     };
 
-    // Get the size of te combinator stack
+    // Get the size of the combinator stack
     public short size () {
 	return (short) this.combine.size();
     };
@@ -62,16 +61,18 @@
     // Add opening highlight combinator to the stack
     public void addOpen (int number) {
 	this.combine.add(new HighlightCombinatorElement((byte) 1, number));
-	this.balanceStack.add(number);
+	this.balanceStack.push(number);
     };
 
     // Add closing highlight combinator to the stack
     public void addClose (int number) {
 	HighlightCombinatorElement lastComb;
+
+	// Clean up temporary stack
 	this.tempStack.clear();
 
-	// Shouldn't happen
-	if (this.balanceStack.size() == 0) {
+	// Check if there is an opening tag at least
+	if (this.balanceStack.empty()) {
 	    if (DEBUG)
 		log.trace("The balance stack is empty");
 	    return;
@@ -88,9 +89,10 @@
 	};
 
 	// class number of the last element
-	int eold = this.balanceStack.removeLast();
+	// It's already ensured the stack is not empty
+	int eold = this.balanceStack.pop();
 
-	// the closing element is not balanced
+	// the closing element is not balanced, i.e. the last element differs
 	while (eold != number) {
 
 	    // Retrieve last combinator on stack
@@ -124,10 +126,10 @@
 	    };
 
 	    // add this element number temporarily on the stack
-	    tempStack.add(eold);
+	    tempStack.push(eold);
 
 	    // Check next element
-	    eold = this.balanceStack.removeLast();
+	    eold = this.balanceStack.pop();
 	};
 
 	// Get last combinator on the stack
@@ -168,7 +170,7 @@
 	    if (DEBUG)
 		log.trace("Reopen element {}", e);
 	    combine.add(new HighlightCombinatorElement((byte) 1, e));
-	    balanceStack.add(e);
+	    balanceStack.push(e);
 	};
     };
 
