Made highlighting more semantic
diff --git a/Changes b/Changes
index a8ecb3d..22f4a94 100644
--- a/Changes
+++ b/Changes
@@ -27,6 +27,8 @@
 	  on focussing (e.g., set by relations) (diewald)
 	- [bugfix] Hopefully fixing a resource related bug for
 	  server instantiation (diewald)
+	- [bugfix] Changed attribute spans to contain element's width (margaretha)
+	- [feature] Improved highlighting to use semantic html5 (#193; diewald)
 
 0.49.3 2015-02-03
         - [documentation] Improved documentation for API classes (diewald)
diff --git a/src/main/java/de/ids_mannheim/korap/match/HighlightCombinatorElement.java b/src/main/java/de/ids_mannheim/korap/match/HighlightCombinatorElement.java
index 6432c0e..dbd3e0a 100644
--- a/src/main/java/de/ids_mannheim/korap/match/HighlightCombinatorElement.java
+++ b/src/main/java/de/ids_mannheim/korap/match/HighlightCombinatorElement.java
@@ -45,66 +45,68 @@
 
     // Return html fragment for this combinator element
     public String toHTML (KorapMatch match, FixedBitSet level, byte[] levelCache) {	    
-	// Opening
-	if (this.type == 1) {
-	    StringBuilder sb = new StringBuilder();
-	    if (this.number == -1) {
-		sb.append("<span class=\"match\">");
-	    }
+        // Opening
+        if (this.type == 1) {
+            StringBuilder sb = new StringBuilder();
+            if (this.number == -1) {
+                sb.append("<mark>");
+            }
 
-	    else if (this.number < -1) {
-		sb.append("<span xml:id=\"")
-		    .append(match.getPosID(
-					   match.getClassID(this.number)))
-		    .append("\">");
-	    }
+            else if (this.number < -1) {
+                sb.append("<span xml:id=\"")
+                    .append(match.getPosID(match.getClassID(this.number)))
+                    .append("\">");
+            }
 
-	    else if (this.number >= 256) {
-		sb.append("<span ");
-		if (this.number < 2048) {
-		    sb.append("title=\"")
-			.append(match.getAnnotationID(this.number))
-			.append('"');
-		}
-		else {
-		    Relation rel = match.getRelationID(this.number);
-		    sb.append("xlink:title=\"")
-			.append(rel.annotation)
-			.append("\" xlink:type=\"simple\" xlink:href=\"#")
-			.append(match.getPosID(rel.ref))
-			.append('"');
-		};
-		sb.append('>');
-	    }
+            else if (this.number >= 256) {
+                sb.append("<span ");
+                if (this.number < 2048) {
+                    sb.append("title=\"")
+                        .append(match.getAnnotationID(this.number))
+                        .append('"');
+                }
+                else {
+                    Relation rel = match.getRelationID(this.number);
+                    sb.append("xlink:title=\"")
+                        .append(rel.annotation)
+                        .append("\" xlink:type=\"simple\" xlink:href=\"#")
+                        .append(match.getPosID(rel.ref))
+                        .append('"');
+                };
+                sb.append('>');
+            }
 
-	    // Highlight - < 256
-	    else {
-		// Get the first free level slot
-		byte pos;
-		if (levelCache[this.number] != '\0') {
-		    pos = levelCache[this.number];
-		}
-		else {
-		    pos = (byte) level.nextSetBit(0);
-		    level.clear(pos);
-		    levelCache[this.number] = pos;
-		};
-		sb.append("<em class=\"class-")
-		    .append(this.number)
-		    .append(" level-")
-		    .append(pos)
-		    .append("\">");
-	    };
-	    return sb.toString();
-	}
-	// Closing
-	else if (this.type == 2) {
-	    if (this.number <= -1 || this.number >= 256)
-		return "</span>";
-
-	    if (this.terminal)
-		level.set((int) levelCache[this.number]);
-	    return "</em>";
+            // Highlight - < 256
+            else {
+                // Get the first free level slot
+                byte pos;
+                if (levelCache[this.number] != '\0') {
+                    pos = levelCache[this.number];
+                }
+                else {
+                    pos = (byte) level.nextSetBit(0);
+                    level.clear(pos);
+                    levelCache[this.number] = pos;
+                };
+                sb.append("<mark class=\"class-")
+                    .append(this.number)
+                    .append(" level-")
+                    .append(pos)
+                    .append("\">");
+            };
+            return sb.toString();
+        }
+        // Closing
+        else if (this.type == 2) {
+            if (this.number < -1 || this.number >= 256)
+                return "</span>";
+           
+            if (this.number == -1)
+                return "</mark>";
+         
+            if (this.terminal)
+                level.set((int) levelCache[this.number]);
+            return "</mark>";
 	};
 
 	// HTML encode primary data
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
index cb27c50..7e47153 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
@@ -59,7 +59,7 @@
         assertEquals(km.getEndPos(),    2);
         assertEquals(km.getStartPos(1), 1);
         assertEquals(km.getEndPos(1),   2);
-        assertEquals("<span class=\"context-left\">a</span><span class=\"match\"><em class=\"class-1 level-0\">b</em></span><span class=\"context-right\">c</span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\">a</span><mark><mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">c</span>", km.getSnippetHTML());
 
         kr = ki.search((SpanQuery) kq.seq(kq._(1, kq.seg("s:b"))).append(kq._(2, kq.seg("s:c"))).toQuery());
         km = kr.getMatch(0);
@@ -69,7 +69,7 @@
         assertEquals(km.getEndPos(1),   2);
         assertEquals(km.getStartPos(2), 2);
         assertEquals(km.getEndPos(2),   3);
-        assertEquals("<span class=\"context-left\">a</span><span class=\"match\"><em class=\"class-1 level-0\">b</em><em class=\"class-2 level-0\">c</em></span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\">a</span><mark><mark class=\"class-1 level-0\">b</mark><mark class=\"class-2 level-0\">c</mark></mark><span class=\"context-right\"></span>", km.getSnippetHTML());
 
 
         kr = ki.search((SpanQuery) kq.seq(kq._(1, kq.seq(kq.seg("s:a")).append(kq.seg("s:b")))).append(kq._(2, kq.seg("s:c"))).toQuery());
@@ -80,7 +80,7 @@
         assertEquals(km.getEndPos(1),   2);
         assertEquals(km.getStartPos(2), 2);
         assertEquals(km.getEndPos(2),   3);
-        assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-1 level-0\">ab</em><em class=\"class-2 level-0\">c</em></span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-1 level-0\">ab</mark><mark class=\"class-2 level-0\">c</mark></mark><span class=\"context-right\"></span>", km.getSnippetHTML());
 
 
         kr = ki.search((SpanQuery) kq._(3, kq.seq(kq._(1, kq.seq(kq.seg("s:a")).append(kq.seg("s:b")))).append(kq._(2, kq.seg("s:c")))).toQuery());
@@ -93,7 +93,7 @@
         assertEquals(km.getEndPos(2),   3);
         assertEquals(km.getStartPos(3), 0);
         assertEquals(km.getEndPos(3),   3);
-        assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-3 level-0\"><em class=\"class-1 level-1\">ab</em><em class=\"class-2 level-1\">c</em></em></span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-3 level-0\"><mark class=\"class-1 level-1\">ab</mark><mark class=\"class-2 level-1\">c</mark></mark></mark><span class=\"context-right\"></span>", km.getSnippetHTML());
     };
 
     @Test
@@ -125,14 +125,14 @@
         KorapResult kr = ki.search((SpanQuery) kq.seq(kq.seg("s:a")).append(kq.seg("s:b")).append(kq.seg("s:c")).toQuery());
         KorapMatch km = kr.getMatch(0);
         km.addHighlight(0, 1, (short) 7);
-        assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-7 level-0\">ab</em>c</span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\">ab</mark>c</mark><span class=\"context-right\"></span>", km.getSnippetHTML());
 
         km.addHighlight(1, 2, (short) 6);
-        assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-7 level-0\">a<em class=\"class-6 level-1\">b</em></em><em class=\"class-6 level-1\">c</em></span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\">a<mark class=\"class-6 level-1\">b</mark></mark><mark class=\"class-6 level-1\">c</mark></mark><span class=\"context-right\"></span>", km.getSnippetHTML());
 
         km.addHighlight(0, 1, (short) 5);
         assertEquals("[{7:{5:a{6:b}}}{6:c}]", km.getSnippetBrackets());
-        assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-7 level-0\"><em class=\"class-5 level-1\">a<em class=\"class-6 level-2\">b</em></em></em><em class=\"class-6 level-2\">c</em></span><span class=\"context-right\"></span>", km.getSnippetHTML());
+        assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\"><mark class=\"class-5 level-1\">a<mark class=\"class-6 level-2\">b</mark></mark></mark><mark class=\"class-6 level-2\">c</mark></mark><span class=\"context-right\"></span>", km.getSnippetHTML());
 
     };
 
@@ -287,7 +287,7 @@
         assertEquals(kr.getTotalResults(),7);
         assertEquals(kr.getStartIndex(),0);
         assertEquals(kr.getMatch(0).getSnippetBrackets(),"... 2. Herkunft Die aus dem proto-semitischen [{15:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><em class=\"class-15 level-0\">Alphabet</em></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-15 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         json = getString(getClass().getResource("/queries/bugs/greater_highlights_16.jsonld").getFile());
 
@@ -298,7 +298,7 @@
         assertEquals(kr.getTotalResults(),7);
         assertEquals(kr.getStartIndex(),0);
         assertEquals(kr.getMatch(0).getSnippetBrackets(),"... 2. Herkunft Die aus dem proto-semitischen [{16:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><em class=\"class-16 level-0\">Alphabet</em></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-16 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 127
         json = getString(getClass().getResource("/queries/bugs/greater_highlights_127.jsonld").getFile());
@@ -309,7 +309,7 @@
         assertEquals(kr.getTotalResults(),7);
         assertEquals(kr.getStartIndex(),0);
         assertEquals(kr.getMatch(0).getSnippetBrackets(),"... 2. Herkunft Die aus dem proto-semitischen [{127:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><em class=\"class-127 level-0\">Alphabet</em></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-127 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 255
         json = getString(getClass().getResource("/queries/bugs/greater_highlights_255.jsonld").getFile());
@@ -320,7 +320,7 @@
         assertEquals(kr.getTotalResults(),7);
         assertEquals(kr.getStartIndex(),0);
         assertEquals(kr.getMatch(0).getSnippetBrackets(),"... 2. Herkunft Die aus dem proto-semitischen [Alphabet] stammende Urform des Buchstaben ist wahrscheinlich ...");
-        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\">Alphabet</span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+        assertEquals(kr.getMatch(0).getSnippetHTML(),"<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark>Alphabet</mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
 
         // 300
         json = getString(getClass().getResource("/queries/bugs/greater_highlights_300.jsonld").getFile());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
index df4c8ae..abf2fad 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
@@ -68,7 +68,7 @@
 	assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
 	assertEquals("SnippetBrackets (0)", "... bcabca[ba]c", kr.getMatch(0).getSnippetBrackets());
 	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\">" +
-			"</span>bcabca</span><span class=\"match\">ba</span><span class=\"context-right" +
+			"</span>bcabca</span><mark>ba</mark><span class=\"context-right" +
 			"\">c</span>", kr.getMatch(0).getSnippetHTML());
 
 	sq = new SpanTermQuery(new Term("base", "s:b"));
@@ -80,8 +80,8 @@
 	assertEquals("SnippetBrackets (0)", "a[b]cabcab ...", kr.getMatch(0).getSnippetBrackets());
 
 
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\">" +
-			"b</span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", 
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">a</span><mark>" +
+			"b</mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", 
 			kr.getMatch(0).getSnippetHTML());
 
 	assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
@@ -98,8 +98,8 @@
 	assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
 	assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
 	assertEquals("snippetBrackets (0)", "a[{1:b}]cabcab ...", kr.getMatch(0).getSnippetBrackets());
-	assertEquals("snippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\">" +
-			"<em class=\"class-1 level-0\">b</em></span><span class=\"context-right\">cabcab<span " +
+	assertEquals("snippetHTML (0)", "<span class=\"context-left\">a</span><mark>" +
+			"<mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span " +
 			"class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
 
 	assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
@@ -123,7 +123,7 @@
 	assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
 	assertEquals("SnippetBrackets (0)", "[a{1:b}]cabcab ...", kr.getMatch(0).getSnippetBrackets());
 
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"></span><span class=\"match\">a<em class=\"class-1 level-0\">b</em></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"></span><mark>a<mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
 
 	assertEquals("StartPos (1)", 3, kr.getMatch(1).startPos);
 	assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
@@ -166,19 +166,19 @@
 
 	assertEquals("totalResults", kr.getTotalResults(), 1);
 	assertEquals("SnippetBrackets (0)", "abcabc[a{2:b{1:a}}]c", kr.getMatch(0).getSnippetBrackets());
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">abcabc</span><span class=\"match\">a<em class=\"class-2 level-0\">b<em class=\"class-1 level-1\">a</em></em></span><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">abcabc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
 
 	// Offset tokens
 	kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
 	assertEquals("totalResults", kr.getTotalResults(), 1);
 	assertEquals("SnippetBrackets (0)", "... bc[a{2:b{1:a}}]c", kr.getMatch(0).getSnippetBrackets());
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\">a<em class=\"class-2 level-0\">b<em class=\"class-1 level-1\">a</em></em></span><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\"></span>bc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
 
 	// Offset Characters
 	kr = ki.search(sq, 0, (short) 10, false, (short) 2, false, (short) 2);
 	assertEquals("totalResults", kr.getTotalResults(), 1);
 	assertEquals("SnippetBrackets (0)", "... bc[a{2:b{1:a}}]c", kr.getMatch(0).getSnippetBrackets());
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\">a<em class=\"class-2 level-0\">b<em class=\"class-1 level-1\">a</em></em></span><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\"></span>bc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
 
 
 	// System.err.println(kr.toJSON());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index e201de4..5d320e4 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -186,22 +186,22 @@
 		     "<span class=\"more\">"+
 		     "</span>"+
 		     "</span>"+
-		     "<span class=\"match\">"+
-		     "<em class=\"class-2 level-0\">"+
+		     "<mark>"+
+		     "<mark class=\"class-2 level-0\">"+
 		     "<span title=\"f/m:acht\">"+
 		     "<span title=\"f/y:eight\">"+
 		     "b"+
 		     "</span>"+
 		     "</span>"+
-		     "<em class=\"class-4 level-1\">"+
+		     "<mark class=\"class-4 level-1\">"+
 		     "<span title=\"f/m:neun\">"+
 		     "<span title=\"f/y:nine\">"+
 		     "a"+
 		     "</span>"+
 		     "</span>"+
-		     "</em>"+
-		     "</em>"+
-		     "</span>"+
+		     "</mark>"+
+		     "</mark>"+
+		     "</mark>"+
 		     "<span class=\"context-right\">"+
 		     "<span class=\"more\">"+
 		     "</span>"+
@@ -229,8 +229,8 @@
 		     "<span class=\"more\">" +
 		     "</span>" +
 		     "</span>" +
-		     "<span class=\"match\">" +
-		     "<em class=\"class-2 level-0\">" +
+		     "<mark>" +
+		     "<mark class=\"class-2 level-0\">" +
 		     "<span title=\"f/m:acht\">" +
 		     "<span title=\"f/y:eight\">" +
 		     "<span title=\"it/is:8\">" +
@@ -240,7 +240,7 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "<em class=\"class-4 level-1\">" +
+		     "<mark class=\"class-4 level-1\">" +
 		     "<span title=\"f/m:neun\">" +
 		     "<span title=\"f/y:nine\">" +
 		     "<span title=\"it/is:9\">" +
@@ -250,9 +250,9 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "</em>" +
-		     "</em>" +
-		     "</span>" +
+		     "</mark>" +
+		     "</mark>" +
+		     "</mark>" +
 		     "<span class=\"context-right\">" +
 		     "<span class=\"more\">" +
 		     "</span>" +
@@ -279,7 +279,7 @@
 		     "<span class=\"more\">" +
 		     "</span>" +
 		     "</span>" +
-		     "<span class=\"match\">" +
+		     "<mark>" +
 		     "<span title=\"f/m:acht\">" +
 		     "<span title=\"f/y:eight\">" +
 		     "<span title=\"it/is:8\">" +
@@ -298,7 +298,7 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "</span>" +
+		     "</mark>" +
 		     "<span class=\"context-right\">" +
 		     "<span class=\"more\">" +
 		     "</span>" +
@@ -367,9 +367,9 @@
 		     "<span class=\"more\">" +
 		     "</span>" +
 		     "</span>" +
-		     "<span class=\"match\">" +
+		     "<mark>" +
 		     "<span title=\"x/tag\">" +
-		     "<em class=\"class-2 level-0\">" +
+		     "<mark class=\"class-2 level-0\">" +
 		     "<span title=\"f/m:acht\">" +
 		     "<span title=\"f/y:eight\">" +
 		     "<span title=\"it/is:8\">" +
@@ -379,7 +379,7 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "<em class=\"class-4 level-1\">" +
+		     "<mark class=\"class-4 level-1\">" +
 		     "<span title=\"f/m:neun\">" +
 		     "<span title=\"f/y:nine\">" +
 		     "<span title=\"it/is:9\">" +
@@ -389,8 +389,8 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "</em>" +
-		     "</em>" +
+		     "</mark>" +
+		     "</mark>" +
 		     "<span title=\"f/m:zehn\">" +
 		     "<span title=\"f/y:ten\">" +
 		     "<span title=\"it/is:10\">" +
@@ -401,7 +401,7 @@
 		     "</span>" +
 		     "</span>" +
 		     "</span>" +
-		     "</span>" +
+		     "</mark>" +
 		     "<span class=\"context-right\">" +
 		     "</span>",
 		     km.getSnippetHTML());
@@ -427,7 +427,7 @@
 	assertEquals("SnippetBrackets (1)",
 		     "<span class=\"context-left\">" +
 		     "</span>" +
-		     "<span class=\"match\">" +
+		     "<mark>" +
 		     "<span xlink:title=\"x/rel:a\" " +
 		     "xlink:type=\"simple\" " +
 		     "xlink:href=\"#word-c1!d1-p3\">" +
@@ -449,7 +449,7 @@
 		     "<span title=\"x/o:fünftens\">" +
 		     "b" +
 		     "</span>" +
-		     "</span>" +
+		     "</mark>" +
 		     "<span class=\"context-right\">" +
 		     "<span class=\"more\">" +
 		     "</span>" +
@@ -466,7 +466,7 @@
 	assertEquals("SnippetBrackets (1)",
 		     "<span class=\"context-left\">" +
 		     "</span>" +
-		     "<span class=\"match\">" +
+		     "<mark>" +
 		     "<span xlink:title=\"x/rel:a\" " +
 		     "xlink:type=\"simple\" " +
 		     "xlink:href=\"#word-c1!d1-p3\">" +
@@ -477,7 +477,7 @@
 		     "<span title=\"x/o:zweitens\">" +
 		     "b" +
 		     "</span>" +
-		     "<em class=\"class-7 level-0\">" +
+		     "<mark class=\"class-7 level-0\">" +
 		     "<span title=\"x/o:drittens\">" +
 		     "c" +
 		     "</span>" +
@@ -486,11 +486,11 @@
 		     "a" +
 		     "</span>" +
 		     "</span>" +
-		     "</em>" +
+		     "</mark>" +
 		     "<span title=\"x/o:fünftens\">" +
 		     "b" +
 		     "</span>" +
-		     "</span>" +
+		     "</mark>" +
 		     "<span class=\"context-right\">" +
 		     "<span class=\"more\">" +
 		     "</span>" +
@@ -572,7 +572,7 @@
 	assertEquals("SnippetHTML (2)",
 		     "<span class=\"context-left\">" +
 		     "</span>" +
-		     "<span class=\"match\">"+
+		     "<mark>"+
 		     "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"+
 		     "<span title=\"f/m:eins\">"+
 		     "<span title=\"f/y:one\">"+
@@ -607,7 +607,7 @@
 		     "</span>"+
 		     "</span>"+
 		     "</span>"+
-		     "</span>"+
+		     "</mark>"+
 		     "<span class=\"context-right\">"+
 		     "<span class=\"more\">"+
 		     "</span>"+
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
index 7de423b..c3ad7c7 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
@@ -72,7 +72,7 @@
 	assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
 	assertEquals("SnippetBrackets (0)", "... bcabca[b{1:a}]c", kr.getMatch(0).getSnippetBrackets());
 
-	assertEquals("Test no 'more' context", "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\">b<em class=\"class-1 level-0\">a</em></span><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("Test no 'more' context", "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><mark>b<mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
 	sq = new SpanFocusQuery(
   	     new SpanNextQuery(
                 new SpanTermQuery(new Term("base", "s:b")),
@@ -102,13 +102,13 @@
 	assertEquals("SnippetBrackets (0)", "a[{3:b}]cabcab ...", kr.getMatch(0).getSnippetBrackets());
 	
 
-	assertEquals("<span class=\"context-left\">a</span><span class=\"match\"><em class=\"class-3 level-0\">b</em></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("<span class=\"context-left\">a</span><mark><mark class=\"class-3 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
 
 	assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
 	assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
 	assertEquals("SnippetBrackets (1)", "abca[{3:b}]cabac", kr.getMatch(1).getSnippetBrackets());
 
-	assertEquals("<span class=\"context-left\">abca</span><span class=\"match\"><em class=\"class-3 level-0\">b</em></span><span class=\"context-right\">cabac</span>", kr.getMatch(1).getSnippetHTML());
+	assertEquals("<span class=\"context-left\">abca</span><mark><mark class=\"class-3 level-0\">b</mark></mark><span class=\"context-right\">cabac</span>", kr.getMatch(1).getSnippetHTML());
 
 	assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
 	assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
@@ -132,7 +132,7 @@
 	assertEquals("totalResults", kr.getTotalResults(), 1);
 	assertEquals("SnippetBrackets (0)", "... bcabca[{2:b{1:a}}]c", kr.getMatch(0).getSnippetBrackets());
 
-	assertEquals("SnippetHTML (0) 1", "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\"><em class=\"class-2 level-0\">b<em class=\"class-1 level-1\">a</em></em></span><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0) 1", "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>", kr.getMatch(0).getSnippetHTML());
 
 	// Offset tokens
 	kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
@@ -146,7 +146,7 @@
 	assertEquals("totalResults", kr.getTotalResults(), 1);
 	assertEquals("SnippetBrackets (0)", "... a[{2:b{1:a}}] ...", kr.getMatch(0).getSnippetBrackets());
 
-	assertEquals("SnippetHTML (0) 2", "<span class=\"context-left\"><span class=\"more\"></span>a</span><span class=\"match\"><em class=\"class-2 level-0\">b<em class=\"class-1 level-1\">a</em></em></span><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
+	assertEquals("SnippetHTML (0) 2", "<span class=\"context-left\"><span class=\"more\"></span>a</span><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
 
 	sq = new SpanFocusQuery(
             new SpanClassQuery(
@@ -241,26 +241,26 @@
         kr = ki.search(sq, (short) 20);
 
         assertEquals("totalResults", kr.getTotalResults(), 7);
-        assertEquals("SnippetBrackets (0)", "<span class=\"context-left\"></span><span class=\"match\">a</span><span class=\"context-right\">bcabca<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
+        assertEquals("SnippetBrackets (0)", "<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\">bcabca<span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
         assertEquals("SnippetBrackets (0)", "[a]bcabca ...", kr.getMatch(0).getSnippetBrackets());
 
         assertEquals("SnippetBrackets (1)", "ab[c]abcaba ...", kr.getMatch(1).getSnippetBrackets());
-        assertEquals("SnippetBrackets (1)", "<span class=\"context-left\">ab</span><span class=\"match\">c</span><span class=\"context-right\">abcaba<span class=\"more\"></span></span>", kr.getMatch(1).getSnippetHTML());
+        assertEquals("SnippetBrackets (1)", "<span class=\"context-left\">ab</span><mark>c</mark><span class=\"context-right\">abcaba<span class=\"more\"></span></span>", kr.getMatch(1).getSnippetHTML());
         
         assertEquals("SnippetBrackets (6)", "... abcaba[c]", kr.getMatch(6).getSnippetBrackets());
-        assertEquals("SnippetBrackets (6)", "<span class=\"context-left\"><span class=\"more\"></span>abcaba</span><span class=\"match\">c</span><span class=\"context-right\"></span>", kr.getMatch(6).getSnippetHTML());
+        assertEquals("SnippetBrackets (6)", "<span class=\"context-left\"><span class=\"more\"></span>abcaba</span><mark>c</mark><span class=\"context-right\"></span>", kr.getMatch(6).getSnippetHTML());
 
         kr = ki.search(sq, 0, (short) 20, true, (short) 0, true, (short) 0);
 
         assertEquals("totalResults", kr.getTotalResults(), 7);
         assertEquals("SnippetBrackets (0)", "[a] ...", kr.getMatch(0).getSnippetBrackets());
-        assertEquals("SnippetHTML (0)", "<span class=\"context-left\"></span><span class=\"match\">a</span><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
+        assertEquals("SnippetHTML (0)", "<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(0).getSnippetHTML());
 
         assertEquals("SnippetBrackets (1)", "... [c] ...", kr.getMatch(1).getSnippetBrackets());
-        assertEquals("SnippetHTML (1)", "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\">c</span><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(1).getSnippetHTML());
+        assertEquals("SnippetHTML (1)", "<span class=\"context-left\"><span class=\"more\"></span></span><mark>c</mark><span class=\"context-right\"><span class=\"more\"></span></span>", kr.getMatch(1).getSnippetHTML());
 
         assertEquals("SnippetBrackets (6)", "... [c]", kr.getMatch(6).getSnippetBrackets());
-        assertEquals("SnippetBrackets (6)", "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\">c</span><span class=\"context-right\"></span>", kr.getMatch(6).getSnippetHTML());
+        assertEquals("SnippetBrackets (6)", "<span class=\"context-left\"><span class=\"more\"></span></span><mark>c</mark><span class=\"context-right\"></span>", kr.getMatch(6).getSnippetHTML());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index e0324d4..62821c7 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -818,7 +818,7 @@
         assertEquals("totalResults", kr.getTotalResults(), 1);
         
         assertEquals("... schrie: [\"{3:Das war ich}!\"] und ...",kr.getMatch(0).getSnippetBrackets());
-        assertEquals("<span class=\"context-left\"><span class=\"more\"></span>schrie: </span><span class=\"match\">&quot;<em class=\"class-3 level-0\">Das war ich</em>!&quot;</span><span class=\"context-right\"> und<span class=\"more\"></span></span>",kr.getMatch(0).getSnippetHTML());
+        assertEquals("<span class=\"context-left\"><span class=\"more\"></span>schrie: </span><mark>&quot;<mark class=\"class-3 level-0\">Das war ich</mark>!&quot;</mark><span class=\"context-right\"> und<span class=\"more\"></span></span>",kr.getMatch(0).getSnippetHTML());
 
         kr = ki.search(sq, 0, (short) 15, true, (short) 0, true, (short) 0);
         assertEquals("... [\"{3:Das war ich}!\"] ...",kr.getMatch(0).getSnippetBrackets());
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKorapResult.java b/src/test/java/de/ids_mannheim/korap/search/TestKorapResult.java
index debd89d..f07b184 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKorapResult.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKorapResult.java
@@ -79,7 +79,7 @@
 	assertEquals(1, res.at("/matches/0/UID").asInt());
 	assertEquals("doc-1", res.at("/matches/0/docID").asText());
 	assertEquals("match-doc-1-p0-1(1)0-0", res.at("/matches/0/ID").asText());
-	assertEquals("<span class=\"context-left\"></span><span class=\"match\"><em class=\"class-1 level-0\">a</em></span><span class=\"context-right\">bab</span>", res.at("/matches/0/snippet").asText());
+	assertEquals("<span class=\"context-left\"></span><mark><mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\">bab</span>", res.at("/matches/0/snippet").asText());
 
 	assertEquals("base", res.at("/matches/6/field").asText());
 	/*
@@ -90,7 +90,7 @@
 	assertEquals(2, res.at("/matches/6/UID").asInt());
 	assertEquals("doc-2", res.at("/matches/6/docID").asText());
 	assertEquals("match-doc-2-p2-3(1)2-2", res.at("/matches/6/ID").asText());
-	assertEquals("<span class=\"context-left\">ab</span><span class=\"match\"><em class=\"class-1 level-0\">a</em></span><span class=\"context-right\"></span>", res.at("/matches/6/snippet").asText());
+	assertEquals("<span class=\"context-left\">ab</span><mark><mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\"></span>", res.at("/matches/6/snippet").asText());
 
     };
 
@@ -189,7 +189,7 @@
 	assertEquals(1, res.at("/matches/0/UID").asInt());
 	assertEquals("doc-1", res.at("/matches/0/docID").asText());
 	assertEquals("match-doc-1-p0-1", res.at("/matches/0/ID").asText());
-	assertEquals("<span class=\"context-left\"></span><span class=\"match\">a</span><span class=\"context-right\">bab</span>", res.at("/matches/0/snippet").asText());
+	assertEquals("<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\">bab</span>", res.at("/matches/0/snippet").asText());
 
     };