diff --git a/src/main/java/LayerTranslator.java b/src/main/java/LayerTranslator.java
deleted file mode 100644
index 5ab9783..0000000
--- a/src/main/java/LayerTranslator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author hanl
- * @date 24/01/2014
- */
-public class LayerTranslator {
-
-    //fixme: standardize
-    private String[] bases = new String[]{"morph", "lemma", "mds", "dep"};
-    private Map<String, String> mapper;
-
-
-    public LayerTranslator() {
-        mapper = new HashMap<>();
-    }
-
-    public void set(String m, String l, String mds, String dep) {
-        mapper.clear();
-        mapper.put(bases[0], m);
-        mapper.put(bases[1], l);
-        mapper.put(bases[2], mds);
-        mapper.put(bases[3], dep);
-    }
-
-    public String translate(String base) {
-        String r = mapper.get(base);
-        if (r != null)
-            return r;
-        return "";
-    }
-}
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
index e34610c..6fa6465 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
@@ -26,6 +26,8 @@
     private List<Map> rq;
     private Multimap<String, String> mfilter;
     private Multimap<String, String> mextension;
+    private Relation simpleFilterRel = Relation.AND;
+    private Relation simpleExtendRel = Relation.AND;
 
 
     public CollectionQuery() {
@@ -57,8 +59,8 @@
         return this;
     }
 
-    public CollectionQuery addMetaFilter(String queries, Relation rel) {
-        this.mfilter.putAll(resRel(queries, rel));
+    public CollectionQuery addMetaFilterQuery(String queries) {
+        this.mfilter.putAll(resRel(queries));
         return this;
     }
 
@@ -67,9 +69,20 @@
         return this;
     }
 
-    public CollectionQuery addMetaExtend(String queries, Relation rel) {
-        this.mextension.putAll(resRel(queries, rel));
 
+    public CollectionQuery setFilterAttributeRelation(Relation rel) {
+        simpleFilterRel = rel;
+        return this;
+    }
+
+
+    public CollectionQuery setExtendAttributeRelation(Relation rel) {
+        simpleExtendRel = rel;
+        return this;
+    }
+
+    public CollectionQuery addMetaExtendQuery(String queries) {
+        this.mextension.putAll(resRel(queries));
         return this;
     }
 
@@ -124,12 +137,12 @@
         return mex;
     }
 
-    private List<Map> join(Relation filter, Relation extension) {
+    private List<Map> join() {
         List<Map> cursor = new ArrayList<>(this.rq);
         if (!this.mfilter.isEmpty())
-            cursor.addAll(this.createFilter(filter));
+            cursor.addAll(this.createFilter(simpleFilterRel));
         if (!this.mextension.isEmpty())
-            cursor.addAll(this.createExtender(extension));
+            cursor.addAll(this.createExtender(simpleExtendRel));
         return cursor;
     }
 
@@ -209,18 +222,13 @@
         return el;
     }
 
-    public List<Map> raw(Relation filter, Relation extension) {
-        return join(filter, extension);
-    }
-
     public List<Map> raw() {
-        return raw(Relation.AND, Relation.AND);
+        return join();
     }
 
-
-    public String toCollections(Relation filter, Relation extension) {
+    public String toCollections() {
         Map meta = new LinkedHashMap();
-        meta.put("collections", join(filter, extension));
+        meta.put("collections", join());
 
         try {
             return serialzer.writeValueAsString(meta);
@@ -230,23 +238,18 @@
         }
     }
 
-    public String toCollections() {
-        return toCollections(Relation.AND, Relation.AND);
-    }
-
-
     /**
      * returns all references to parents and meta query as string representation
      *
      * @return
      */
-    public JsonNode buildNode(Relation filter, Relation extension) {
-        return serialzer.valueToTree(join(filter, extension));
+    public JsonNode buildNode() {
+        return serialzer.valueToTree(join());
     }
 
-    public String buildString(Relation filter, Relation extension) {
+    public String buildString() {
         try {
-            return serialzer.writeValueAsString(join(filter, extension));
+            return serialzer.writeValueAsString(join());
         } catch (JsonProcessingException e) {
             e.printStackTrace();
             return "";
@@ -262,9 +265,11 @@
      * @param queries
      * @return
      */
-    private Multimap<String, String> resRel(String queries, Relation rel) {
+    private Multimap<String, String> resRel(String queries) {
         Multimap<String, String> qmap = ArrayListMultimap.create();
-        String[] spl = queries.trim().split(rel.toString());
+        String rel = queries.contains("AND") ? "AND" : "OR";
+
+        String[] spl = queries.trim().split(rel);
         for (String query : spl) {
             String[] q = query.split("=");
             if (q.length > 1) {
@@ -272,7 +277,7 @@
                 String val = q[1].trim();
                 qmap.put(attr, val);
             }
-            //return error when query not well formed
+            // todo: return error when query not well-formed
         }
         return qmap;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
index f7f0ec6..5312274 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
@@ -22,7 +22,8 @@
         this.meta = new LinkedHashMap();
     }
 
-    public MetaQuery addContext(Integer left, String leftType, Integer right, String rightType) {
+    public MetaQuery addContext(Integer left, String leftType,
+                                Integer right, String rightType) {
         Map map = new LinkedHashMap();
         List l = new LinkedList();
         List r = new LinkedList();
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index ee0cac9..a798968 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -3,7 +3,6 @@
 import com.fasterxml.jackson.core.JsonGenerationException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
 import de.ids_mannheim.korap.util.QueryException;
 import org.slf4j.LoggerFactory;
 
@@ -20,12 +19,14 @@
 
     private ObjectMapper mapper;
     private AbstractSyntaxTree ast;
+    private Object collection;
+    private Object meta;
     private org.slf4j.Logger log = LoggerFactory
             .getLogger(QuerySerializer.class);
 
     public QuerySerializer() {
         mapper = new ObjectMapper();
-        mapper.enable(SerializationFeature.INDENT_OUTPUT);
+//        mapper.enable(SerializationFeature.INDENT_OUTPUT);
     }
 
     /**
@@ -127,9 +128,7 @@
     }
 
     // change page to startindex
-    public String buildQuery(String query, String ql, String collection,
-                             String cli, String cri, int cls, int crs,
-                             int num, int page, String version)
+    public QuerySerializer setQuery(String query, String ql, String version)
             throws QueryException {
         try {
             if (ql.toLowerCase().equals("poliqarp")) {
@@ -151,25 +150,48 @@
         } catch (Exception e) {
             throw new QueryException("UNKNOWN: Query could not be parsed");
         }
+        return this;
+    }
 
-        Map<String, Object> requestMap = ast.getRequestMap();
-
-        //todo: use startindex instead
-        MetaQuery meta = new MetaQuery();
-        meta.addContext(cls, cli, crs, cri);
-//        meta.addEntry("startPage", page);
-        meta.addEntry("startIndex", page);
-        meta.addEntry("count", num);
-
-        CollectionQuery qobj = new CollectionQuery();
-        qobj.addResource(collection);
-
+    public final String build() {
         try {
-            requestMap.put("collections", qobj.raw());
-            requestMap.put("meta", meta.raw());
-            return mapper.writeValueAsString(requestMap);
+            return mapper.writeValueAsString(raw());
         } catch (IOException e) {
             return "";
         }
     }
+
+
+    private Map raw() {
+        Map<String, Object> requestMap = ast.getRequestMap();
+        if (collection != null)
+            requestMap.put("collections", collection);
+        if (meta != null)
+            requestMap.put("meta", meta);
+        return requestMap;
+    }
+
+
+    public QuerySerializer setMeta(
+            String cli, String cri, int cls, int crs,
+            int num, int pageIndex) {
+        MetaQuery meta = new MetaQuery();
+        meta.addContext(cls, cli, crs, cri);
+        meta.addEntry("startIndex", pageIndex);
+        meta.addEntry("count", num);
+        this.meta = meta.raw();
+        return this;
+    }
+
+    public QuerySerializer setCollection(String collection) {
+        CollectionQuery qobj = new CollectionQuery();
+        qobj.addResource(collection);
+        this.collection = qobj.raw();
+        return this;
+    }
+
+    public QuerySerializer setCollection(CollectionQuery collections) {
+        this.collection = collections.raw();
+        return this;
+    }
 }
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 1995510..f8dc4e6 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -29,11 +29,10 @@
         b.append("pubPlace:Erfurt");
         b.append(" AND ");
         b.append("textClass:wissenschaft");
-//        CollectionQuery qu = new CollectionQuery().addMetaFilter(b.toString());
-        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(),
-                Relation.AND);
-        System.out.println(query.buildString(Relation.AND, Relation.AND));
-        System.out.println(query.toCollections(Relation.AND, Relation.AND));
+//        CollectionQuery qu = new CollectionQuery().addMetaFilterQuery(b.toString());
+        CollectionQuery query = new CollectionQuery().addMetaFilterQuery(b.toString());
+        System.out.println(query.buildString());
+        System.out.println(query.toCollections());
 //        System.out.println("value reference " + qu.stringify());
 //        System.out.println();
     }
@@ -42,7 +41,7 @@
     public void testSingle() throws IOException {
         CollectionQuery query = new CollectionQuery().addMetaFilter("textClass", "wissenschaft");
 //        System.out.println("------ TEXT SINGLE " + query.stringify());
-        System.out.println(query.buildString(Relation.AND, Relation.AND));
+        System.out.println(query.buildString());
     }
 
     @Test
@@ -53,10 +52,10 @@
         b.append("pubDate:<2012-04-01");
         b.append(" AND ");
         b.append("author:Goethe");
-        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), Relation.AND);
-        System.out.println("value until/since : " + query.buildString(Relation.AND, Relation.AND));
-        System.out.println("meta value until/since " + query.toCollections(Relation.AND, Relation.AND));
-        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Goethe\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"between\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2012-04-01\"},{\"@type\":\"korap:date\",\"@value\":\"2013-04-01\"}]}]}}]", query.buildString(Relation.AND, Relation.AND));
+        CollectionQuery query = new CollectionQuery().addMetaFilterQuery(b.toString());
+        System.out.println("value until/since : " + query.buildString());
+        System.out.println("meta value until/since " + query.toCollections());
+        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Goethe\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"between\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2012-04-01\"},{\"@type\":\"korap:date\",\"@value\":\"2013-04-01\"}]}]}}]", query.buildString());
 //        System.out.println();
     }
 
@@ -66,9 +65,9 @@
         b.append("pubDate:>2013-12-10");
         b.append(" AND ");
         b.append("author:Hesse");
-        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), Relation.AND);
+        CollectionQuery query = new CollectionQuery().addMetaFilterQuery(b.toString());
         System.out.println("Running date check (until) with additional attribute author");
-        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Hesse\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"until\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString(Relation.AND, Relation.AND));
+        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Hesse\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"until\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString());
 //        System.out.println("value until : " + query.stringify());
 //        System.out.println();
     }
@@ -79,13 +78,12 @@
         b.append("pubDate:<2013-12-10");
         b.append(" AND ");
         b.append("author:Kafka");
-        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), Relation.AND);
-        System.out.println("value since : " + query.buildString(Relation.AND,
-                Relation.AND));
-        System.out.println("meta value since " + query.toCollections(Relation.AND, Relation.AND));
+        CollectionQuery query = new CollectionQuery().addMetaFilterQuery(b.toString());
+        System.out.println("value since : " + query.buildString());
+        System.out.println("meta value since " + query.toCollections());
 //        System.out.println();
         System.out.println("Running date check (since) with additional attribute author");
-        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Kafka\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"since\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString(Relation.AND, Relation.AND));
+        Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Kafka\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"since\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString());
     }
 
     @Test
@@ -128,10 +126,10 @@
         b.append("pubDate:<2013-12-10");
         b.append(" AND ");
         b.append("author:Kafka");
-        CollectionQuery q = new CollectionQuery().addMetaFilter(b.toString(), Relation.AND);
+        CollectionQuery q = new CollectionQuery().addMetaFilterQuery(b.toString());
         q.addMetaExtend("author", "Hesse");
 
-        System.out.println("--- ALL " + q.buildString(Relation.AND, Relation.AND));
+        System.out.println("--- ALL " + q.buildString());
         System.out.println();
 
     }
@@ -142,8 +140,8 @@
         b.append("pubDate:<2013-12-10");
         b.append(" AND ");
         b.append("author:Kafka");
-        CollectionQuery q = new CollectionQuery().addMetaExtend(b.toString(), Relation.AND);
-        System.out.println("array repres " + q.buildString(Relation.AND, Relation.AND));
+        CollectionQuery q = new CollectionQuery().addMetaExtendQuery(b.toString());
+        System.out.println("array repres " + q.buildString());
         System.out.println();
     }
 
@@ -152,8 +150,8 @@
         CollectionQuery q = new CollectionQuery().addMetaFilter("corpusID", "A00");
         q.addMetaExtend("corpusID", "A01");
 
-        System.out.println("results stringified " + q.buildString(Relation.AND, Relation.AND));
-        System.out.println("results to meta" + q.toCollections(Relation.AND, Relation.AND));
+        System.out.println("results stringified " + q.buildString());
+        System.out.println("results to meta" + q.toCollections());
         System.out.println();
     }
 
@@ -168,13 +166,13 @@
         String meta = "[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]";
         CollectionQuery q = new CollectionQuery().addResource(meta);
         System.out.println("Testing Resource Meta data");
-        org.junit.Assert.assertEquals("{\"collections\":" + meta + "}", q.toCollections(Relation.AND, Relation.AND));
+        org.junit.Assert.assertEquals("{\"collections\":" + meta + "}", q.toCollections());
     }
 
     @Test
     public void testA00() throws IOException {
         CollectionQuery q = new CollectionQuery().addMetaExtend("corpusID", "A00").addMetaExtend("corpusID", "A01");
-        System.out.println("A meta: " + q.buildString(Relation.AND, Relation.AND));
+        System.out.println("A meta: " + q.buildString());
         System.out.println();
     }
 
@@ -183,8 +181,8 @@
         String meta = "[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]";
         CollectionQuery q = new CollectionQuery().addResource(meta);
         q.addMetaFilter("textClass", "wissenschaft");
-        System.out.println("stringified meta " + q.buildString(Relation.AND, Relation.AND));
-        System.out.println("meta string " + q.toCollections(Relation.AND, Relation.AND));
+        System.out.println("stringified meta " + q.buildString());
+        System.out.println("meta string " + q.toCollections());
     }
 
 }
