diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
index 00f95f9..d3ad13c 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
@@ -1,12 +1,14 @@
 package de.mannheim.ids.korap.sru;
 
 import java.io.BufferedInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.http.HttpStatus;
 import org.apache.http.NameValuePair;
@@ -35,8 +37,9 @@
  */
 public class KorapClient {
 
-    private static final String SERVICE_URI = "http://localhost:8089/api/v0.1/";
-    // "http://10.0.10.13:7070/api/v0.1/";
+    private static String SERVICE_URI;
+    private static final String CONFIGURATION_FILE = "kustvakt.conf";
+    private static final String SERVICE_URI_PROPERTY = "korapsru.client.service.uri";
     private static final String DEFAULT_CONTEXT_TYPE = "sentence";
     private static final String DEFAULT_FOUNDRY = "*";
 
@@ -47,6 +50,7 @@
     private static Logger logger = (Logger) LoggerFactory
             .getLogger(KorapClient.class);
 
+
     /**
      * Constructs a KorapClient with the given number of records per
      * page and the maximum number of records.
@@ -55,12 +59,34 @@
      *            the number of records per page
      * @param maxRecords
      *            the number of maximum records/matches to retrieve
+     * @throws FileNotFoundException
      */
-    public KorapClient (int numOfRecords, int maxRecords) {
+    public KorapClient (int numOfRecords, int maxRecords)
+            throws FileNotFoundException {
         this.defaultNumOfRecords = numOfRecords;
         this.defaultMaxRecords = maxRecords;
+
+        Properties properties = new Properties();
+        InputStream is = getClass().getClassLoader()
+                .getResourceAsStream(CONFIGURATION_FILE);
+        try {
+            properties.load(is);
+        }
+        catch (IOException e) {
+            throw new FileNotFoundException("Configuration file "
+                    + CONFIGURATION_FILE + " is not found in the classpath.");
+        }
+        if (properties.containsKey(SERVICE_URI_PROPERTY)) {
+            SERVICE_URI = properties.getProperty("korapsru.client.service.uri");
+            logger.info(SERVICE_URI);
+        }
+        else {
+            throw new NullPointerException("Please specify korapsru.client."
+                    + "service.uri in the configuration file.");
+        }
     }
 
+
     /**
      * Gets information about available resources to search through
      * the KorAP public services.
@@ -70,7 +96,8 @@
      * @throws URISyntaxException
      * @throws IOException
      */
-    public JsonNode retrieveResources() throws URISyntaxException, IOException {
+    public JsonNode retrieveResources ()
+            throws URISyntaxException, IOException {
 
         URIBuilder builder = new URIBuilder(SERVICE_URI + "VirtualCollection");
         // builder.addParameter("type", "VirtualCollection");
@@ -90,12 +117,12 @@
                 logger.warn("Error response code: " + statusCode);
                 logger.warn("Error message: "
                         + response.getStatusLine().getReasonPhrase());
-                throw new HttpResponseException(statusCode, response
-                        .getStatusLine().getReasonPhrase());
+                throw new HttpResponseException(statusCode,
+                        response.getStatusLine().getReasonPhrase());
             }
 
-            BufferedInputStream jsonStream = new BufferedInputStream(response
-                    .getEntity().getContent());
+            BufferedInputStream jsonStream = new BufferedInputStream(
+                    response.getEntity().getContent());
             try {
                 resources = objectMapper.readValue(jsonStream, JsonNode.class);
             }
@@ -113,6 +140,7 @@
         return resources;
     }
 
+
     /**
      * Sends the given query to KorAP search API and creates a
      * KorapResult from the response.
@@ -134,7 +162,7 @@
      * @throws HttpResponseException
      * @throws IOException
      */
-    public KorapResult query(String query, QueryLanguage queryLanguage,
+    public KorapResult query (String query, QueryLanguage queryLanguage,
             String version, int startRecord, int maximumRecords,
             String[] corpora) throws HttpResponseException, IOException {
 
@@ -172,8 +200,8 @@
                 parseError(response);
             }
 
-            BufferedInputStream jsonStream = new BufferedInputStream(response
-                    .getEntity().getContent());
+            BufferedInputStream jsonStream = new BufferedInputStream(
+                    response.getEntity().getContent());
             try {
                 result = objectMapper.readValue(jsonStream, KorapResult.class);
             }
@@ -184,6 +212,9 @@
                 jsonStream.close();
             }
         }
+        catch (IOException e) {
+            throw new IOException("Failed executing HTTP request.",e);
+        }
         finally {
             response.close();
         }
@@ -191,18 +222,20 @@
         return result;
     }
 
+
     /**
-     * Parses the error message from Kustvakt (probably an old format).
+     * Parses the error message from Kustvakt (probably an old
+     * format).
      * 
      * @param response
      *            a response from Kustvakt
      * @throws IOException
      */
-    private static void parseError(CloseableHttpResponse response)
+    private static void parseError (CloseableHttpResponse response)
             throws IOException {
 
-        logger.warn("Error message: "
-                + response.getStatusLine().getReasonPhrase());
+        logger.warn(
+                "Error message: " + response.getStatusLine().getReasonPhrase());
 
         InputStream is = response.getEntity().getContent();
         JsonNode node = objectMapper.readTree(is);
@@ -225,6 +258,7 @@
                 errorItems[1]);
     }
 
+
     /**
      * Builds a search retrieve GET request for the given parameters.
      * 
@@ -241,7 +275,7 @@
      * @return a HttpGet request
      * @throws URISyntaxException
      */
-    private HttpGet createSearchRequest(String query,
+    private HttpGet createSearchRequest (String query,
             QueryLanguage queryLanguage, String version, int startRecord,
             int maximumRecords) throws URISyntaxException {
 
@@ -259,9 +293,10 @@
         params.add(new BasicNameValuePair("ql", queryLanguage.toString()));
         params.add(new BasicNameValuePair("v", version));
         params.add(new BasicNameValuePair("context", DEFAULT_CONTEXT_TYPE));
-        params.add(new BasicNameValuePair("count", String
-                .valueOf(maximumRecords)));
-        params.add(new BasicNameValuePair("offset", String.valueOf(startRecord)));
+        params.add(new BasicNameValuePair("count",
+                String.valueOf(maximumRecords)));
+        params.add(
+                new BasicNameValuePair("offset", String.valueOf(startRecord)));
 
         URIBuilder builder = new URIBuilder(SERVICE_URI + "search");
         builder.addParameters(params);
@@ -272,6 +307,7 @@
         return request;
     }
 
+
     /**
      * Sends a request to the MatchInfo API to get the annotations of
      * a particular match identified with corpus/resource id, document
@@ -291,8 +327,8 @@
      * @throws IOException
      * @throws URISyntaxException
      */
-    public static String retrieveAnnotations(String resourceId,
-            String documentId, String matchId, String foundry)
+    public static String retrieveAnnotations (String resourceId,
+            String documentId, String textId, String matchId, String foundry)
             throws IOException, URISyntaxException {
 
         if (resourceId == null) {
@@ -324,7 +360,7 @@
         }
 
         HttpUriRequest httpRequest;
-        httpRequest = createMatchInfoRequest(resourceId, documentId, matchId,
+        httpRequest = createMatchInfoRequest(resourceId, documentId, textId, matchId,
                 foundry);
 
         String annotationSnippet = null;
@@ -340,8 +376,8 @@
                 parseError(response);
             }
 
-            BufferedInputStream jsonStream = new BufferedInputStream(response
-                    .getEntity().getContent());
+            BufferedInputStream jsonStream = new BufferedInputStream(
+                    response.getEntity().getContent());
             try {
                 JsonNode root = objectMapper.readTree(jsonStream);
                 annotationSnippet = "<snippet>" + root.at("/snippet").asText()
@@ -361,6 +397,7 @@
         return annotationSnippet;
     }
 
+
     /**
      * Builds a request URL to send to the KorAP MatchInfo service.
      * 
@@ -375,17 +412,18 @@
      * @return a HttpGet request
      * @throws URISyntaxException
      */
-    private static HttpGet createMatchInfoRequest(String resourceId,
-            String documentId, String matchId, String foundry)
+    private static HttpGet createMatchInfoRequest (String resourceId,
+            String documentId, String textId, String matchId, String foundry)
             throws URISyntaxException {
 
         StringBuilder sb = new StringBuilder();
         sb.append(SERVICE_URI);
-        // sb.append("http://localhost:8089/api/v0.1/");
         sb.append("corpus/");
         sb.append(resourceId);
         sb.append("/");
         sb.append(documentId);
+        sb.append(".");
+        sb.append(textId);
         sb.append("/");
         sb.append(matchId);
         sb.append("/matchInfo?foundry=");
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapMatch.java b/src/main/java/de/mannheim/ids/korap/sru/KorapMatch.java
index b5c2889..fd0c1c1 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapMatch.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapMatch.java
@@ -14,6 +14,7 @@
     private String matchID;
     private String positionId;
     private String docId;
+    private String textId;
     private String corpusId;
     private String leftContext;
     private String keyword;
@@ -23,7 +24,7 @@
 
     private List<AnnotationLayer> annotationLayers = new ArrayList<AnnotationLayer>();
     
-    private static Pattern idPattern = Pattern.compile("match-(.*)_(.*)-p([0-9]+-[0-9]+)");
+    private static Pattern idPattern = Pattern.compile("match-(.*)/(.*)/(.*)-p([0-9]+-[0-9]+)");
 
     public KorapMatch () {}
     
@@ -41,7 +42,8 @@
         if (matcher.find()){
             this.corpusId = matcher.group(1);
             this.docId = matcher.group(2);
-            this.positionId = "p"+matcher.group(3);
+            this.setTextId(matcher.group(3));
+            this.positionId = "p"+matcher.group(4);
         }
     } 
     
@@ -53,12 +55,20 @@
         return positionId;
     }
 
+    public String getTextId () {
+        return textId;
+    }
+
+    public void setTextId (String textId) {
+        this.textId = textId;
+    }
+
     public String getDocId() {
         return docId;
     }
 
     public void setDocId(String docID) {
-        this.docId = docID.replace(corpusId + "_", "");
+        this.docId = docID;
     }
 
     public String getCorpusId() {
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
index 4e1c4db..59c1d65 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
@@ -1,5 +1,6 @@
 package de.mannheim.ids.korap.sru;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -55,8 +56,13 @@
             SRUQueryParserRegistry.Builder parserRegistryBuilder,
             Map<String, String> params) throws SRUConfigException {
         // serverConfig = config;
-        korapClient = new KorapClient(config.getNumberOfRecords(),
-                config.getMaximumRecords());
+        try {
+            korapClient = new KorapClient(config.getNumberOfRecords(),
+                    config.getMaximumRecords());
+        }
+        catch (FileNotFoundException e) {
+            throw new SRUConfigException(e.getMessage());
+        }
 
         StringBuilder sb = new StringBuilder();
         sb.append(config.getTransports());
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapSRUSearchResultSet.java b/src/main/java/de/mannheim/ids/korap/sru/KorapSRUSearchResultSet.java
index 7f0d3b6..95fed85 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapSRUSearchResultSet.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapSRUSearchResultSet.java
@@ -109,7 +109,6 @@
     public void writeRecord(XMLStreamWriter writer) throws XMLStreamException {
         KorapMatch match = korapResult.getMatch(i);
         match.parseMatchId();
-
         XMLStreamWriterHelper.writeStartResource(writer, match.getMatchId(),
                 null);
         XMLStreamWriterHelper.writeStartResourceFragment(writer, null, null);
@@ -162,10 +161,10 @@
 
         try {
             String annotationSnippet = KorapClient.retrieveAnnotations(
-                    match.getCorpusId(), match.getDocId(),
+                    match.getCorpusId(), match.getDocId(), match.getTextId(),
                     match.getPositionId(), "*");
             InputStream is = new ByteArrayInputStream(
-                    annotationSnippet.getBytes());
+                    annotationSnippet.getBytes("UTF-8"));
             saxParser.parse(is, annotationHandler);
         }
         catch (SAXException | IOException | URISyntaxException e) {
diff --git a/src/main/resources/kustvakt.conf b/src/main/resources/kustvakt.conf
new file mode 100644
index 0000000..3216d34
--- /dev/null
+++ b/src/main/resources/kustvakt.conf
@@ -0,0 +1,5 @@
+# KorAP configuration file that is also used in Krill and Kustvakt.
+
+# Configuration for KorapSRU
+korapsru.client.service.uri=http://localhost:8089/api/v0.1/
+#korapsru.client.service.uri=http://10.0.10.13:7070/api/v0.1/
\ No newline at end of file
