diff --git a/pom.xml b/pom.xml
index cc137fa3e366209be41e26b90e9ef7fbd01a4a27..92e80b7296552e13ad028fe184ffcedbda76cb3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<cyclonedx-maven-plugin.version>2.7.0</cyclonedx-maven-plugin.version>
 		<hamcrest.version>1.3</hamcrest.version>
-		<idiom-queries.version>1.1.60</idiom-queries.version>
+		<idiom-queries.version>1.3.0</idiom-queries.version>
 		<javax-servlet.version>3.1.0</javax-servlet.version>
 		<javax-ws.version>2.0</javax-ws.version>
 		<jdeb.version>1.4</jdeb.version>
diff --git a/src/main/java/org/classicmayan/tools/ParserAPI.java b/src/main/java/org/classicmayan/tools/ParserAPI.java
index 2e4a9668eab38014545b8c058bf01fa130c7b314..6f6f935a8072e07836475cf7d883006d339759d2 100644
--- a/src/main/java/org/classicmayan/tools/ParserAPI.java
+++ b/src/main/java/org/classicmayan/tools/ParserAPI.java
@@ -35,7 +35,7 @@ public interface ParserAPI {
 
   /**
    * @param tei: identifier of the object containing the the to be parsed transcription code
-   * @param artefact: identifier of the artefact. Necessary to get the link to the textcarrier
+   * @param artefact: identifier of the artifact. Necessary to get the link to the text carrier
    * @param sid: parameter to identify the access rights to the file
    * @return
    * @throws SAXException
@@ -48,10 +48,7 @@ public interface ParserAPI {
    */
   @GET
   @Path("/parse")
-  // @Produces({ "application/xml", "text/xml" })
-  // @Produces(MediaType.TEXT_PLAIN)
   @Produces(MediaType.TEXT_XML)
-  // @Consumes(MediaType.TEXT_XML)
   Document parseToTEI(@QueryParam("tei") String uriToTEIFile,
       @QueryParam("artefact") String uriToArtefact,
       @QueryParam("title") String title,
diff --git a/src/main/java/org/classicmayan/tools/ParsingProducer.java b/src/main/java/org/classicmayan/tools/ParsingProducer.java
index fbd6365c91db4468b98bf20868feb958c7f469ed..1cd8833ce516058ba20c75e83bdfb6f7fb7904a5 100644
--- a/src/main/java/org/classicmayan/tools/ParsingProducer.java
+++ b/src/main/java/org/classicmayan/tools/ParsingProducer.java
@@ -1,23 +1,35 @@
 package org.classicmayan.tools;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import javax.activation.DataHandler;
+import javax.mail.util.ByteArrayDataSource;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXB;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.ws.Holder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import info.textgrid.clients.CrudClient;
+import info.textgrid.clients.tgcrud.CrudClientException;
+import info.textgrid.namespaces.metadata.core._2010.MetadataContainerType;
 import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.AuthFault;
 import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.IoFault;
 import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.MetadataParseFault;
 import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.ObjectNotFoundFault;
 import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.ProtocolNotImplementedFault;
+import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.TGCrudService;
+import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.tgcrudclient.TGCrudClientUtilities;
 
 /**
  *
@@ -56,21 +68,22 @@ public class ParsingProducer implements ParserAPI {
     DocumentBuilder builder;
     Document doc = null;
 
-    IDIOMTextGridObject idiomTGObject = new IDIOMTextGridObject();
-    idiomTGObject.setSid(sessionid);
-    String uriToSave = idiomTGObject.generateTextGridUri();
+    IdiomTextGridObject idiomTGObject = new IdiomTextGridObject();
+    idiomTGObject.setSessionID(sessionid);
+    // FIXME Set classicmayan project ID via configuration file here! (see Queries Collection
+    // configuration!)
+    idiomTGObject.setProjectID("TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318");
 
     try {
       builder = factory.newDocumentBuilder();
       doc = builder.parse(new InputSource(new StringReader(tei)));
       try {
-        idiomTGObject.saveToTextGrid(uriToSave, tei, title, "textgrid:3rq31", true);
+        saveToTextGrid(idiomTGObject, tei, title, "textgrid:3rq31");
       } catch (ObjectNotFoundFault e) {
-        this.log.error("Object with URI: " + uriToSave + " not found ");
+        this.log.error("Object not found");
         e.printStackTrace();
       } catch (AuthFault e) {
-        this.log
-            .error("Object with URI: " + uriToSave + "is not accessible with sid: " + sessionid);
+        this.log.error("Object is not accessible");
         e.printStackTrace();
       } catch (IoFault e) {
         // TODO Auto-generated catch block
@@ -126,4 +139,71 @@ public class ParsingProducer implements ParserAPI {
     return "Wuhu";
   }
 
+  // **
+  // PRIVATE METHODS
+  // **
+
+  /**
+   * @param tgObject
+   * @param jsonFile
+   * @param title
+   * @param aggregationURI
+   * @throws ObjectNotFoundFault
+   * @throws AuthFault
+   * @throws IoFault
+   * @throws MetadataParseFault
+   * @throws ProtocolNotImplementedFault
+   * @throws IOException
+   * @throws CrudClientException
+   */
+  public void saveToTextGrid(IdiomTextGridObject tgObject, String jsonFile, String title,
+      String aggregationURI) throws ObjectNotFoundFault, AuthFault, IoFault, MetadataParseFault,
+      ProtocolNotImplementedFault, IOException, CrudClientException {
+
+    // TODO Use textgrid-java-clients here?!
+    TGCrudService crudClient = TGCrudClientUtilities.getTgcrud(CrudClient.DEFAULT_ENDPOINT);
+
+    // Create metadata from template string, add title.
+    String template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+        "<ns3:tgObjectMetadata\n" +
+        "xmlns:ns3=\"http://textgrid.info/namespaces/metadata/core/2010\"\n" +
+        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+        "xsi:schemaLocation=\"http://textgrid.info/namespaces/metadata/core/2010 http://textgridlab.org/schema/textgrid-metadata_2010.xsd\">\n"
+        +
+        "<ns3:object>\n" +
+        "<ns3:generic>\n" +
+        "<ns3:provided>\n" +
+        "<ns3:title>" + title + "</ns3:title>\n" +
+        "<ns3:format>text/xml</ns3:format>\n" +
+        "</ns3:provided>\n" +
+        "</ns3:generic>\n" +
+        "<ns3:item />\n" +
+        "</ns3:object>\n" +
+        "</ns3:tgObjectMetadata>";
+    ByteArrayInputStream theMetadataStream = new ByteArrayInputStream(template.getBytes());
+    MetadataContainerType metadata = JAXB.unmarshal(theMetadataStream, MetadataContainerType.class);
+
+    // JAXB.marshal(metadata, System.out);
+
+    Holder<MetadataContainerType> metadataHolder = new Holder<MetadataContainerType>(metadata);
+    DataHandler objectData =
+        new DataHandler(new ByteArrayDataSource(jsonFile.getBytes(), "application/octet-stream"));
+
+    // Set PARSER FILE type here in notes of metadata.
+    metadataHolder.value.getObject().getGeneric().getProvided().setNotes("PARSER_FILE");
+
+    // Create new TEI file.
+    crudClient.create(tgObject.getSessionID(), "", "", false, tgObject.getProjectID(),
+        metadataHolder, objectData);
+
+    // Get TextGrid URI from result metadata.
+    MetadataContainerType resultMetadata = metadataHolder.value;
+    List<String> textgridURI = new ArrayList<String>();
+    textgridURI
+        .add(resultMetadata.getObject().getGeneric().getGenerated().getTextgridUri().getValue());
+
+    // Add new object to existing aggregation.
+    tgObject.addUriListToAggregation(textgridURI, aggregationURI);
+  }
+
 }
diff --git a/src/main/webapp/WEB-INF/beans.xml b/src/main/webapp/WEB-INF/beans.xml
index 377c4a01d2473ed6da2c8a321ca2d6936f982968..b8449373736fc6e87240b6e23e70317dbcc45b5e 100644
--- a/src/main/webapp/WEB-INF/beans.xml
+++ b/src/main/webapp/WEB-INF/beans.xml
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
-	xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:util="http://www.springframework.org/schema/util"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+	xmlns:util="http://www.springframework.org/schema/util"
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
 	http://www.springframework.org/schema/beans/spring-beans.xsd 
 	http://cxf.apache.org/jaxws
@@ -11,17 +12,11 @@
 	http://cxf.apache.org/schemas/jaxrs.xsd
 	http://www.springframework.org/schema/util
 	http://www.springframework.org/schema/util/spring-util-3.1.xsd">
-
 	<description>Configuration for the IDIOM TEI parser</description>
-
-<import resource="classpath:META-INF/cxf/cxf.xml" />
-<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
-
-
-
+	<import resource="classpath:META-INF/cxf/cxf.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 	<bean id="rest" class="org.classicmayan.tools.ParsingProducer">
 	</bean>
-
 	<jaxrs:server id="root" address="/">
 		<jaxrs:serviceBeans>
 			<ref bean="rest" />
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 9ae25f6505fd30fc23408ccae27d20f26087cf57..05ad32d7796c5be258d688e993bada00686ab1fa 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -1,41 +1,23 @@
 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
-	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 	      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
-	      version="2.5">
-	      
-  <display-name>teiparser</display-name>
-
-	 <listener>
-	 	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	 </listener>
-
-  <context-param>
-    <param-name>contextConfigLocation</param-name>
-    <param-value>WEB-INF/beans.xml</param-value>
-  </context-param>
-
- <servlet>
-	<servlet-name>teiparser</servlet-name>
-	<servlet-class>
-		org.apache.cxf.transport.servlet.CXFServlet
-	</servlet-class>
-	<load-on-startup>1</load-on-startup>
-</servlet>
-
-<!--
-    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
-    <init-param>
-      <param-name>jersey.config.server.provider.packages</param-name>
-      <param-value>com.github.hriebl.bdnDatabase</param-value>
-    </init-param>
-    <load-on-startup>1</load-on-startup>
-  </servlet>
--->
-
-
-  <servlet-mapping>
-    <servlet-name>teiparser</servlet-name>
-    <url-pattern>/teiparser/*</url-pattern>
-  </servlet-mapping>
+	version="2.5">
+	<display-name>teiparser</display-name>
+	<listener>
+		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+	</listener>
+	<context-param>
+		<param-name>contextConfigLocation</param-name>
+		<param-value>WEB-INF/beans.xml</param-value>
+	</context-param>
+	<servlet>
+		<servlet-name>teiparser</servlet-name>
+		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>teiparser</servlet-name>
+		<url-pattern>/teiparser/*</url-pattern>
+	</servlet-mapping>
 </web-app>