Return backend version in results
diff --git a/pom.xml b/pom.xml
index caeff94..e3d15d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,14 +86,6 @@
       <version>1.3</version>
     </dependency>
 
-
-    <!-- getopt -->
-    <dependency>
-      <groupId>gnu.getopt</groupId>
-      <artifactId>java-getopt</artifactId>
-      <version>1.0.13</version>
-    </dependency>
-
     <!-- JCache -->
     <dependency>
       <groupId>net.sf.jsr107cache</groupId>
@@ -195,5 +187,40 @@
         </configuration>
       </plugin> 
     </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+	<includes>
+	  <include>index.properties</include>
+	</includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+	<excludes>
+	  <exclude>index.properties</exclude>
+	</excludes>
+      </resource>
+    </resources> 
+
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+	<includes>
+	  <include>index.properties</include>
+	</includes>
+      </testResource>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>false</filtering>
+	<excludes>
+	  <exclude>index.properties</exclude>
+	</excludes>
+      </testResource>
+    </testResources> 
+
   </build>
 </project>
diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index f9a758a..edeb8de 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -2,10 +2,9 @@
 
 import java.util.*;
 
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
 
-// import java.net.URL;
+import java.net.URL;
 
 import java.nio.ByteBuffer;
 import java.util.zip.GZIPInputStream;
@@ -118,6 +117,7 @@
     private int autoCommit = 500; // Todo: Use configuration
     private HashMap termContexts;
     private ObjectMapper mapper = new ObjectMapper();
+    private String version;
 
 
     private static ByteBuffer bb       = ByteBuffer.allocate(4),
@@ -134,6 +134,16 @@
     // This advices the java compiler to ignore all loggings
     public static final boolean DEBUG = false;
 
+    {
+	Properties prop = new Properties();
+	URL file = getClass().getResource("/index.properties");
+
+	if (file != null) {
+	    InputStream fr = new FileInputStream(file.getFile());
+	    prop.load(fr);
+	    this.version = prop.getProperty("lucene.index.version");
+	};
+    };
 
     public KorapIndex () throws IOException {
         this((Directory) new RAMDirectory());
@@ -175,6 +185,9 @@
 	this.config = new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer);
     };
 
+    public String getVersion () {
+	return this.version;
+    };
 
     public void close () throws IOException {
 	this.closeReader();
@@ -357,7 +370,9 @@
      * @param field The field containing the textual data and the annotations.
      * @param type The type of meta information, e.g. "documents" or "sentences".
      */
-    public long numberOf (KorapCollection collection, String field, String type) throws IOException {
+    public long numberOf (KorapCollection collection,
+			  String field,
+			  String type) throws IOException {
 	// Short cut for documents
 	if (type.equals("documents")) {
 	    if (collection.getCount() <= 0) {
@@ -516,6 +531,9 @@
 
 	KorapMatch match = new KorapMatch(idString, includeHighlights);
 
+	if (this.getVersion() != null)
+	    match.setVersion(this.getVersion());
+
 	// Create a filter based on the corpusID and the docID
 	BooleanQuery bool = new BooleanQuery();
 	bool.add(new TermQuery(new Term("ID",       match.getDocID())),    BooleanClause.Occur.MUST);
@@ -836,6 +854,9 @@
 	    ks.rightContext.getLength()
 	);
 
+	if (this.getVersion() != null)
+	    kr.setVersion(this.getVersion());
+
 	HashSet<String> fieldsToLoadLocal = new HashSet<>(fieldsToLoad);
 	fieldsToLoadLocal.add(field);
 
@@ -1000,8 +1021,7 @@
 		};
 
 		// Benchmark till now
-		if (i >= kr.itemsPerPage() &&
-		    kr.getBenchmarkSearchResults().length() == 0) {
+		if (kr.getBenchmarkSearchResults() == null) {
 		    t2 = System.nanoTime();
 		    kr.setBenchmarkSearchResults(t1, t2);
 		};
@@ -1017,7 +1037,7 @@
 
 	    t1 = System.nanoTime();
 	    kr.setBenchmarkHitCounter(t2, t1);
-	    if (kr.getBenchmarkSearchResults().length() == 0) {
+	    if (kr.getBenchmarkSearchResults() == null) {
 		kr.setBenchmarkSearchResults(t2, t1);
 	    };
 
diff --git a/src/main/java/de/ids_mannheim/korap/KorapMatch.java b/src/main/java/de/ids_mannheim/korap/KorapMatch.java
index a99813b..dca773a 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapMatch.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapMatch.java
@@ -55,6 +55,7 @@
 	       potentialEndPosChar   = -1;
 
     private String error = null;
+    private String version;
 
     // TEMPRARILY
     @JsonIgnore
@@ -273,6 +274,18 @@
     };
 
     @JsonIgnore
+    public void setVersion (String version) {
+	this.version = version;
+    };
+
+    @JsonIgnore
+    public String getVersion () {
+	if (this.version == null)
+	    return null;
+	return "lucene-backend-" + this.version;
+    };
+
+    @JsonIgnore
     public int getStartPos() {
 	return this.startPos;
     };
@@ -1097,6 +1110,9 @@
 	context.put("right", rightContext);
 	json.put("context", context);
 
+	if (this.version != null)
+	    json.put("version", this.getVersion());
+
 	try {
 	    return mapper.writeValueAsString(json);
 	}
diff --git a/src/main/java/de/ids_mannheim/korap/KorapResult.java b/src/main/java/de/ids_mannheim/korap/KorapResult.java
index 7f4cf54..68ddac6 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapResult.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapResult.java
@@ -34,9 +34,10 @@
     private boolean leftTokenContext,
 	            rightTokenContext;
 
-    private String benchmarkSearchResults = "",
-	           benchmarkHitCounter = "0";
+    private String benchmarkSearchResults,
+	           benchmarkHitCounter;
     private String error = null;
+    private String version;
 
     private JsonNode request;
 
@@ -109,11 +110,24 @@
 	return this.totalResults;
     };
 
+
     @Deprecated
     public int totalResults () {
 	return this.totalResults;
     };
 
+    @JsonIgnore
+    public void setVersion (String version) {
+	this.version = version;
+    };
+
+    @JsonIgnore
+    public String getVersion () {
+	if (this.version == null)
+	    return null;
+	return "lucene-backend-" + this.version;
+    };
+    
     public short getItemsPerPage () {
 	return this.itemsPerPage;
     };
@@ -140,7 +154,9 @@
     };
 
     public void setBenchmarkSearchResults (long t1, long t2) {
-	this.benchmarkSearchResults = ((double)(t2 - t1) / 1000000000.0) + " s";
+	this.benchmarkSearchResults =
+	    (t2 - t1) < 100_000_000 ? (((double)(t2 - t1) * 1e-6) + " ms") :
+	    (((double)(t2 - t1) / 1000000000.0) + " s");
     };
 
     public String getBenchmarkSearchResults () {
@@ -148,7 +164,9 @@
     };
 
     public void setBenchmarkHitCounter (long t1, long t2) {
-	this.benchmarkHitCounter = ((double)(t2 - t1) / 1000000000.0) + " s";
+	this.benchmarkHitCounter =
+	    (t2 - t1) < 100_000_000 ? (((double)(t2 - t1) * 1e-6) + " ms") :
+	    (((double)(t2 - t1) / 1000000000.0) + " s");
     };
 
     public String getBenchmarkHitCounter () {
@@ -193,6 +211,9 @@
 	context.put("right", rightContext);
 	json.put("context", context);
 
+	if (this.version != null)
+	    json.put("version", this.version);
+
 	try {
 	    return mapper.writeValueAsString(json);
 	}
diff --git a/src/main/resources/index.properties b/src/main/resources/index.properties
new file mode 100644
index 0000000..fa1fd47
--- /dev/null
+++ b/src/main/resources/index.properties
@@ -0,0 +1 @@
+lucene.index.version = ${project.version}
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 c1855da..48d6815 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
@@ -290,5 +290,7 @@
 
 	assertEquals("totalResults", 1, kr.totalResults());
 	assertEquals("SnippetBrackets (0)", "... ca[{1:ba{2:c}}]", kr.match(0).snippetBrackets());
+
+	//	System.err.println(kr.toJSON());
     };
 };
diff --git a/src/test/resources/index.properties b/src/test/resources/index.properties
new file mode 100644
index 0000000..fa1fd47
--- /dev/null
+++ b/src/test/resources/index.properties
@@ -0,0 +1 @@
+lucene.index.version = ${project.version}
diff --git a/todo.txt b/todo.txt
index 40f0a61..15a91a4 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1 +1,2 @@
 - Fix ALL @ignored tests!
+- optimize matchmodifyclassspans