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 5cdd28c..c17bdc2 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
@@ -18,18 +18,19 @@
  */
 public class CollectionQuery {
 
+
+    private static ObjectMapper serialzer = new ObjectMapper();
     private JsonFactory factory;
     private CollectionTypes types;
-    private ObjectMapper serialzer;
     private List<Map> rq;
-    private List<Map> mfil;
-    private List<Map> mext;
+    private Multimap<String, String> mfilter;
+    private Multimap<String, String> mextension;
+
 
     public CollectionQuery() {
-        this.serialzer = new ObjectMapper();
         this.rq = new ArrayList<>();
-        this.mfil = new ArrayList<>();
-        this.mext = new ArrayList<>();
+        this.mfilter = ArrayListMultimap.create();
+        this.mextension = ArrayListMultimap.create();
         this.factory = serialzer.getFactory();
         this.types = new CollectionTypes();
     }
@@ -53,6 +54,84 @@
         return this;
     }
 
+
+    public CollectionQuery addMetaFilter(String key, String value) {
+        this.mfilter.put(key, value);
+        return this;
+    }
+
+    public CollectionQuery addMetaFilter(String queries) {
+        this.mfilter.putAll(resEq(queries));
+        return this;
+    }
+
+    public CollectionQuery addMetaExtend(String attr, String val) {
+        this.mextension.put(attr, val);
+        return this;
+    }
+
+    public CollectionQuery addMetaExtend(String queries) {
+        this.mextension.putAll(resEq(queries));
+        return this;
+    }
+
+
+    private List<Map> createFilter() {
+        List<Map> mfil = new ArrayList();
+        boolean multypes = this.mfilter.keys().size() > 1;
+        String def_key = null;
+
+        if (!multypes) {
+            Multiset<String> keys = this.mfilter.keys();
+            def_key = keys.toArray(new String[keys.size()])[0];
+        }
+
+        List value = this.createValue(this.mfilter);
+        if (mfilter.values().size() == 1)
+            Collections.addAll(mfil, types.createMetaFilter((Map) value.get(0)));
+        else {
+            Map group;
+            if (!multypes)
+                group = types.createGroup("and", def_key, value);
+            else
+                group = types.createGroup("and", null, value);
+            Collections.addAll(mfil, types.createMetaFilter(group));
+        }
+        return mfil;
+    }
+
+    private List<Map> createExtender() {
+        List<Map> mex = new ArrayList();
+        boolean multypes = this.mextension.keys().size() > 1;
+        String def_key = null;
+
+        if (!multypes)
+            def_key = this.mextension.keys().toArray(new String[0])[0];
+
+        List value = this.createValue(this.mextension);
+        // todo: missing: - takes only one resource, but resources can be chained!
+        if (this.mextension.values().size() == 1)
+            Collections.addAll(mex, types.createMetaExtend((Map) value.get(0)));
+        else {
+            Map group;
+            if (!multypes)
+                group = types.createGroup("and", def_key, value);
+            else
+                group = types.createGroup("and", null, value);
+            Collections.addAll(mex, types.createMetaExtend(group));
+        }
+        return mex;
+    }
+
+    private List<Map> join() {
+        List<Map> cursor = new ArrayList<>(this.rq);
+        if (!this.mfilter.isEmpty())
+            cursor.addAll(this.createFilter());
+        if (!this.mextension.isEmpty())
+            cursor.addAll(this.createExtender());
+        return cursor;
+    }
+
     private List createValue(Multimap<String, String> map) {
         List value = new ArrayList<>();
         String[] dates = new String[3];
@@ -101,65 +180,6 @@
         return value;
     }
 
-    // fixme: map can only have one key/value pair. thus,
-    // fixme: text class can only be added once. Multiple types are not possible!
-    public CollectionQuery addMetaFilter(String queries) {
-        Multimap<String, String> m = resEq(queries);
-        boolean multypes = m.keys().size() > 1;
-        String def_key = null;
-
-
-        if (!multypes){
-            Multiset<String> keys = m.keys();
-            def_key = keys.toArray(new String[keys.size()])[0];
-        }
-
-        List value = this.createValue(m);
-        // todo: missing: - takes only one resource, but resources can be chained!
-        if (m.values().size() == 1)
-            Collections.addAll(this.mfil, types.createMetaFilter((Map) value.get(0)));
-        else {
-            Map group;
-            if (!multypes)
-                group = types.createGroup("and", def_key, value);
-            else
-                group = types.createGroup("and", null, value);
-            Collections.addAll(this.mfil, types.createMetaFilter(group));
-        }
-        return this;
-    }
-
-    public CollectionQuery addMetaExtend(String queries) {
-        Multimap<String, String> m = resEq(queries);
-        boolean multypes = m.keys().size() > 1;
-        String def_key = null;
-
-        if (!multypes)
-            def_key = m.keys().toArray(new String[0])[0];
-
-        List value = this.createValue(m);
-        // todo: missing: - takes only one resource, but resources can be chained!
-        if (m.values().size() == 1)
-            Collections.addAll(this.mext, types.createMetaExtend((Map) value.get(0)));
-        else {
-            Map group;
-            if (!multypes)
-                group = types.createGroup("and", def_key, value);
-            else
-                group = types.createGroup("and", null, value);
-            Collections.addAll(this.mext, types.createMetaExtend(group));
-        }
-        return this;
-    }
-
-    public CollectionQuery addMetaFilter(String attr, String val) {
-        return addMetaFilter(attr + ":" + val);
-    }
-
-    public CollectionQuery addMetaExtend(String attr, String val) {
-        return addMetaExtend(attr + ":" + val);
-    }
-
     private String[] processDates(List<String> dates) {
         if (dates.isEmpty())
             return new String[3];
@@ -182,38 +202,17 @@
         return el;
     }
 
-    public void clear() {
-        this.rq.clear();
-        this.mfil.clear();
-        this.mext.clear();
+    public List<Map> raw() {
+        return join();
     }
 
-    private List<Map> join() {
-        List<Map> cursor = new ArrayList<>(this.rq);
-        cursor.addAll(this.mfil);
-        cursor.addAll(this.mext);
-        return cursor;
-    }
 
-    private List<Map> getCollectionsOnly() {
-        List<Map> cursor = new ArrayList<>(this.mfil);
-        cursor.addAll(this.mext);
-        return cursor;
-    }
-
-    /**
-     * returns the meta query only and does not contain parent dependencies
-     *
-     * @return
-     */
-    @Deprecated
-    public String stringify() {
-        List collection = getCollectionsOnly();
-        if (collection.isEmpty())
-            return "";
+    public String toCollections() {
+        Map meta = new LinkedHashMap();
+        meta.put("collections", join());
 
         try {
-            return serialzer.writeValueAsString(collection);
+            return serialzer.writeValueAsString(meta);
         } catch (JsonProcessingException e) {
             e.printStackTrace();
             return "";
@@ -237,34 +236,6 @@
 
 
     /**
-     * returns the List<Map> that contains all the meta queries and resource queries
-     * added to the meta query container
-     *
-     * @return
-     */
-    public List<Map> raw() {
-        return join();
-    }
-
-    /**
-     * returns a JSON String representation that contains all information
-     * (meta query and resource meta queries alike) in a root meta JSON node
-     *
-     * @return
-     */
-    public String toCollections() {
-        Map meta = new LinkedHashMap();
-        meta.put("collections", join());
-
-        try {
-            return serialzer.writeValueAsString(meta);
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-            return "";
-        }
-    }
-
-    /**
      * resolves all queries as equal (hierarchy) AND relations
      *
      * @param queries
@@ -283,15 +254,9 @@
     }
 
 
-    /**
-     * resolves query string with AND and OR relations alike!
-     *
-     * @param queries
-     * @return
-     */
-    private Multimap<String, String> resDep(String queries) {
-        return null;
+    public void clear() {
+        this.rq.clear();
+        this.mfilter.clear();
+        this.mextension.clear();
     }
-
-
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionTypes.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionTypes.java
index 8f98259..799acb1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionTypes.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionTypes.java
@@ -90,6 +90,8 @@
         return meta;
     }
 
+
+
     public Map mapify(String s) throws IOException {
         return mapper.readValue(s, Map.class);
     }
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 03cd549..c5d1fbd 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -3,10 +3,8 @@
 import com.fasterxml.jackson.databind.JsonMappingException;
 import de.ids_mannheim.korap.query.serialize.CollectionQuery;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.query.serialize.MetaQuery;
 import de.ids_mannheim.korap.util.QueryException;
 
-import org.joda.time.DateTime;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,7 +29,10 @@
         b.append("pubPlace:Erfurt");
         b.append(" AND ");
         b.append("textClass:wissenschaft");
-        CollectionQuery qu = new CollectionQuery().addMetaFilter(b.toString());
+//        CollectionQuery qu = new CollectionQuery().addMetaFilter(b.toString());
+        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
+        System.out.println(query.build());
+        System.out.println(query.toCollections());
 //        System.out.println("value reference " + qu.stringify());
 //        System.out.println();
     }
@@ -40,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();
+        System.out.println(query.build());
     }
 
     @Test
@@ -52,9 +53,9 @@
         b.append(" AND ");
         b.append("author:Goethe");
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        System.out.println("value until/since : " + query.stringify());
+        System.out.println("value until/since : " + query.build());
         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.stringify());
+        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.build());
 //        System.out.println();
     }
 
@@ -66,7 +67,7 @@
         b.append("author:Hesse");
         CollectionQuery query = new CollectionQuery().addMetaFilter(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.stringify());
+        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.build());
 //        System.out.println("value until : " + query.stringify());
 //        System.out.println();
     }
@@ -78,11 +79,11 @@
         b.append(" AND ");
         b.append("author:Kafka");
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        System.out.println("value since : " + query.stringify());
+        System.out.println("value since : " + query.build());
         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.stringify());
+        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.build());
     }
 
     @Test
@@ -125,11 +126,11 @@
         b.append("pubDate:<2013-12-10");
         b.append(" AND ");
         b.append("author:Kafka");
-        CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        query.addMetaExtend("author", "Hesse");
+        CollectionQuery q = new CollectionQuery().addMetaFilter(b.toString());
+        q.addMetaExtend("author", "Hesse");
 
-//        System.out.println("--- ALL " + query.stringify());
-//        System.out.println();
+        System.out.println("--- ALL " + q.build());
+        System.out.println();
 
     }
 
@@ -140,8 +141,8 @@
         b.append(" AND ");
         b.append("author:Kafka");
         CollectionQuery q = new CollectionQuery().addMetaExtend(b.toString());
-//        System.out.println("array repres " + q.toMeta());
-//        System.out.println();
+        System.out.println("array repres " + q.build());
+        System.out.println();
     }
 
     @Test
@@ -149,9 +150,9 @@
         CollectionQuery q = new CollectionQuery().addMetaFilter("corpusID", "A00");
         q.addMetaExtend("corpusID", "A01");
 
-//        System.out.println("results stringified " + q.stringify());
-//        System.out.println("results to meta" + q.toMeta());
-//        System.out.println();
+        System.out.println("results stringified " + q.build());
+        System.out.println("results to meta" + q.toCollections());
+        System.out.println();
     }
 
     /**
@@ -164,17 +165,15 @@
     public void testResources() throws IOException {
         String meta = "[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]";
         CollectionQuery q = new CollectionQuery().addResource(meta);
-        org.junit.Assert.assertEquals("String should be empty", "", q.stringify());
-//        System.out.println("meta string " + q.toMeta());
         System.out.println("Testing Resource Meta data");
-        org.junit.Assert.assertEquals("{\"meta\":" + meta + "}", q.toCollections());
+        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.stringify());
-//        System.out.println();
+        System.out.println("A meta: " + q.build());
+        System.out.println();
     }
 
     @Test
@@ -182,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.stringify());
-//        System.out.println("meta string " + q.toMeta());
+        System.out.println("stringified meta " + q.build());
+        System.out.println("meta string " + q.toCollections());
     }
 
 }
