diff --git a/pom.xml b/pom.xml
index 27de904..042468d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <!-- <parent> <groupId>KorAP-modules</groupId> <artifactId>KorAP-core-modules</artifactId> 
        <version>1.1</version> </parent> -->
 
-  <groupId>KorAP-modules</groupId>
+  <groupId>de.ids_mannheim.korap</groupId>
   <artifactId>Koral</artifactId>
   <version>0.2</version>
   <packaging>jar</packaging>
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/IdWriter.java b/src/main/java/de/ids_mannheim/korap/query/serialize/IdWriter.java
index d9302aa..95e32db 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/IdWriter.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/IdWriter.java
@@ -71,12 +71,6 @@
     }
 
 
-    @Deprecated
-    public JsonNode getFinalNode () {
-        return this.node;
-    }
-
-
     public String toJSON () {
         try {
             return mapper.writeValueAsString(node);
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
index eaca680..534253b 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
@@ -16,43 +16,40 @@
     private Map meta;
     private SpanContext spanContext;
 
-
-    public MetaQueryBuilder () {
+    public MetaQueryBuilder() {
         this.meta = new LinkedHashMap();
+        this.meta.put("fields", new LinkedList<>());
     }
 
-
     /**
      * context segment if context is either of type char or token.
      * size can differ for left and right span
-     * 
+     *
      * @param left
      * @param leftType
      * @param right
      * @param rightType
      * @return
      */
-    public MetaQueryBuilder setSpanContext (Integer left, String leftType,
+    public MetaQueryBuilder setSpanContext(Integer left, String leftType,
             Integer right, String rightType) {
         this.spanContext = new SpanContext(left, leftType, right, rightType);
         return this;
     }
 
-
-    public SpanContext getSpanContext () {
+    public SpanContext getSpanContext() {
         return this.spanContext;
     }
 
-
     /**
      * context if of type paragraph or sentence where left and right
      * size delimiters are irrelevant; or 2-token, 2-char p/paragraph,
      * s/sentence or token, char
-     * 
+     *
      * @param context
      * @return
      */
-    public MetaQueryBuilder setSpanContext (String context) {
+    public MetaQueryBuilder setSpanContext(String context) {
         if (context.startsWith("s") | context.startsWith("p"))
             this.spanContext = new SpanContext(context);
         else {
@@ -65,30 +62,12 @@
         return this;
     }
 
-
-    public MetaQueryBuilder fillMeta (Integer pageIndex, Integer pageInteger,
-            Integer pageLength, String ctx, Boolean cutoff) {
-        if (pageIndex != null)
-            this.addEntry("startIndex", pageIndex);
-        if (pageIndex == null && pageInteger != null)
-            this.addEntry("startPage", pageInteger);
-        if (pageLength != null)
-            this.addEntry("count", pageLength);
-        if (ctx != null)
-            this.setSpanContext(ctx);
-        if (cutoff != null)
-            this.addEntry("cutOff", cutoff);
-        return this;
-    }
-
-
-    public MetaQueryBuilder addEntry (String name, Object value) {
+    public MetaQueryBuilder addEntry(String name, Object value) {
         meta.put(name, value);
         return this;
     }
 
-
-    public Map raw () {
+    public Map raw() {
         if (this.spanContext != null)
             meta.putAll(this.spanContext.raw());
         return meta;
@@ -102,31 +81,28 @@
         private int right_size;
         private String context = null;
 
-
         /**
          * context segment if context is either of type char or token.
          * size can differ for left and right span
-         * 
+         *
          * @param ls
          * @param lt
          * @param rs
          * @param rt
          * @return
          */
-        public SpanContext (int ls, String lt, int rs, String rt) {
+        public SpanContext(int ls, String lt, int rs, String rt) {
             this.left_type = lt;
             this.left_size = ls;
             this.right_type = rt;
             this.right_size = rs;
         }
 
-
-        public SpanContext (String context) {
+        public SpanContext(String context) {
             this.context = context;
         }
 
-
-        public Map raw () {
+        public Map raw() {
             Map meta = new LinkedHashMap();
             if (this.context == null) {
                 Map map = new LinkedHashMap();
@@ -139,8 +115,7 @@
                 r.add(this.right_size);
                 map.put("right", r);
                 meta.put("context", map);
-            }
-            else
+            }else
                 meta.put("context", this.context);
             return meta;
         }
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 90d29ed..a4a978b 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
@@ -4,10 +4,8 @@
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import de.ids_mannheim.korap.query.serialize.util.KoralObjectGenerator;
 import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
-
 import org.apache.log4j.BasicConfigurator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -18,7 +16,7 @@
 /**
  * Main class for Koral, serializes queries from concrete QLs to
  * KoralQuery
- * 
+ *
  * @author Joachim Bingel (bingel@ids-mannheim.de),
  *         Michael Hanl (hanl@ids-mannheim.de)
  * @version 0.3.0
@@ -30,8 +28,8 @@
 
     static {
         qlProcessorAssignment = new HashMap<String, Class<? extends AbstractQueryProcessor>>();
-        qlProcessorAssignment.put("poliqarpplus",
-                PoliqarpPlusQueryProcessor.class);
+        qlProcessorAssignment
+                .put("poliqarpplus", PoliqarpPlusQueryProcessor.class);
         qlProcessorAssignment.put("cosmas2", Cosmas2QueryProcessor.class);
         qlProcessorAssignment.put("annis", AnnisQueryProcessor.class);
         qlProcessorAssignment.put("cql", CqlQueryProcessor.class);
@@ -50,11 +48,16 @@
     private org.slf4j.Logger log = LoggerFactory
             .getLogger(QuerySerializer.class);
 
+    public QuerySerializer() {
+        this.errors = new LinkedList<>();
+        this.warnings = new LinkedList<>();
+        this.messages = new LinkedList<>();
+    }
 
     /**
      * @param args
      */
-    public static void main (String[] args) {
+    public static void main(String[] args) {
         /*
          * just for testing...
          */
@@ -67,8 +70,7 @@
             System.err
                     .println("Usage: QuerySerializer \"query\" queryLanguage");
             System.exit(1);
-        }
-        else {
+        }else {
             queries = new String[] { args[0] };
             ql = args[1];
         }
@@ -77,127 +79,99 @@
             try {
                 jg.run(q, ql);
                 System.out.println();
-            }
-            catch (NullPointerException npe) {
+            }catch (NullPointerException npe) {
                 npe.printStackTrace();
                 System.out.println("null\n");
-            }
-            catch (JsonGenerationException e) {
+            }catch (JsonGenerationException e) {
                 e.printStackTrace();
-            }
-            catch (JsonMappingException e) {
+            }catch (JsonMappingException e) {
                 e.printStackTrace();
-            }
-            catch (IOException e) {
+            }catch (IOException e) {
                 e.printStackTrace();
             }
         }
     }
 
-
     /**
      * Runs the QuerySerializer by initializing the relevant
      * AbstractSyntaxTree implementation (depending on specified query
      * language) and transforms and writes the tree's requestMap to
      * the specified output file.
-     * 
-     * @param outFile
-     *            The file to which the serialization is written
-     * @param query
-     *            The query string
-     * @param queryLanguage
-     *            The query language. As of 17 Dec 2014, this must be
-     *            one of 'poliqarpplus', 'cosmas2', 'annis' or 'cql'.
+     *
+     * @param query         The query string
+     * @param queryLanguage The query language. As of 17 Dec 2014, this must be
+     *                      one of 'poliqarpplus', 'cosmas2', 'annis' or 'cql'.
      * @throws IOException
      */
-    public void run (String query, String queryLanguage) throws IOException {
+    public void run(String query, String queryLanguage) throws IOException {
         if (queryLanguage.equalsIgnoreCase("poliqarp")) {
             ast = new PoliqarpPlusQueryProcessor(query);
-        }
-        else if (queryLanguage.equalsIgnoreCase("cosmas2")) {
+        }else if (queryLanguage.equalsIgnoreCase("cosmas2")) {
             ast = new Cosmas2QueryProcessor(query);
-        }
-        else if (queryLanguage.equalsIgnoreCase("poliqarpplus")) {
+        }else if (queryLanguage.equalsIgnoreCase("poliqarpplus")) {
             ast = new PoliqarpPlusQueryProcessor(query);
-        }
-        else if (queryLanguage.equalsIgnoreCase("cql")) {
+        }else if (queryLanguage.equalsIgnoreCase("cql")) {
             ast = new CqlQueryProcessor(query);
-        }
-        else if (queryLanguage.equalsIgnoreCase("annis")) {
+        }else if (queryLanguage.equalsIgnoreCase("annis")) {
             ast = new AnnisQueryProcessor(query);
-        }
-        else {
-            throw new IllegalArgumentException(queryLanguage
-                    + " is not a supported query language!");
+        }else {
+            throw new IllegalArgumentException(
+                    queryLanguage + " is not a supported query language!");
         }
         toJSON();
     }
 
-
-    public QuerySerializer setQuery (String query, String ql, String version) {
+    public QuerySerializer setQuery(String query, String ql, String version) {
         ast = new DummyQueryProcessor();
         if (query == null || query.isEmpty()) {
             ast.addError(StatusCodes.NO_QUERY, "You did not specify a query!");
-        }
-        else if (ql == null || ql.isEmpty()) {
+        }else if (ql == null || ql.isEmpty()) {
             ast.addError(StatusCodes.NO_QUERY,
                     "You did not specify any query language!");
-        }
-        else if (ql.equalsIgnoreCase("poliqarp")) {
+        }else if (ql.equalsIgnoreCase("poliqarp")) {
             ast = new PoliqarpPlusQueryProcessor(query);
-        }
-        else if (ql.equalsIgnoreCase("cosmas2")) {
+        }else if (ql.equalsIgnoreCase("cosmas2")) {
             ast = new Cosmas2QueryProcessor(query);
-        }
-        else if (ql.equalsIgnoreCase("poliqarpplus")) {
+        }else if (ql.equalsIgnoreCase("poliqarpplus")) {
             ast = new PoliqarpPlusQueryProcessor(query);
-        }
-        else if (ql.equalsIgnoreCase("cql")) {
+        }else if (ql.equalsIgnoreCase("cql")) {
             if (version == null)
                 ast = new CqlQueryProcessor(query);
             else
                 ast = new CqlQueryProcessor(query, version);
-        }
-        else if (ql.equalsIgnoreCase("annis")) {
+        }else if (ql.equalsIgnoreCase("annis")) {
             ast = new AnnisQueryProcessor(query);
-        }
-        else {
-            ast.addError(StatusCodes.UNKNOWN_QL, ql
-                    + " is not a supported query language!");
+        }else {
+            ast.addError(StatusCodes.UNKNOWN_QL,
+                    ql + " is not a supported query language!");
         }
         return this;
     }
 
-
-    public QuerySerializer setQuery (String query, String ql) {
+    public QuerySerializer setQuery(String query, String ql) {
         return setQuery(query, ql, "");
     }
 
-
-    public void setVerbose (boolean verbose) {
+    public void setVerbose(boolean verbose) {
         AbstractQueryProcessor.verbose = verbose;
     }
 
-
-    public final String toJSON () {
+    public final String toJSON() {
         String ser;
         try {
             ser = mapper.writeValueAsString(raw());
             qllogger.info("Serialized query: " + ser);
-        }
-        catch (JsonProcessingException e) {
+        }catch (JsonProcessingException e) {
             return "";
         }
         return ser;
     }
 
-
-    public final Map build () {
+    public final Map build() {
         return raw();
     }
 
-
-    private Map raw () {
+    private Map raw() {
         if (ast != null) {
             Map<String, Object> requestMap = ast.getRequestMap();
             Map meta = (Map) requestMap.get("meta");
@@ -229,28 +203,25 @@
         return new HashMap<>();
     }
 
-
-    private Map<String, Object> mergeCollection (
-            Map<String, Object> collection1, Map<String, Object> collection2) {
+    private Map<String, Object> mergeCollection(Map<String, Object> collection1,
+            Map<String, Object> collection2) {
         LinkedHashMap<String, Object> docGroup = KoralObjectGenerator
                 .makeDocGroup("and");
         ArrayList<Object> operands = (ArrayList<Object>) docGroup
                 .get("operands");
         if (collection1 == null || collection1.isEmpty()) {
             return collection2;
-        }
-        else if (collection2 == null || collection2.isEmpty()) {
+        }else if (collection2 == null || collection2.isEmpty()) {
             return collection1;
-        }
-        else {
+        }else {
             operands.add(collection1);
             operands.add(collection2);
             return docGroup;
         }
     }
 
-
-    public QuerySerializer addMeta (String cli, String cri, int cls, int crs,
+    @Deprecated
+    public QuerySerializer addMeta(String cli, String cri, int cls, int crs,
             int num, int pageIndex) {
         MetaQueryBuilder meta = new MetaQueryBuilder();
         meta.setSpanContext(cls, cli, crs, cri);
@@ -260,50 +231,26 @@
         return this;
     }
 
+    public QuerySerializer setMeta(Map<String, Object> meta) {
+        this.meta = meta;
+        return this;
+    }
 
-    public QuerySerializer addMeta (String context, int num, int pageidx) {
-        MetaQueryBuilder meta = new MetaQueryBuilder();
-        meta.addEntry("startIndex", pageidx);
-        meta.addEntry("count", num);
-        meta.setSpanContext(context);
+    public QuerySerializer addMeta(MetaQueryBuilder meta) {
         this.meta = meta.raw();
         return this;
     }
 
-
-    public QuerySerializer addMeta (MetaQueryBuilder meta) {
-        this.meta = meta.raw();
-        return this;
-    }
-
-
-    //    @Deprecated public QuerySerializer setCollectionSimple(String collection) {
-    //        CollectionQueryBuilder qobj = new CollectionQueryBuilder();
-    //        qobj.addResource(collection);
-    //        this.collection = (Map<String, Object>) qobj.raw();
-    //        return this;
-    //    }
-
-    public QuerySerializer setCollection (String collection) {
+    public QuerySerializer setCollection(String collection) {
         CollectionQueryProcessor tree = new CollectionQueryProcessor();
         Map<String, Object> collectionRequest = tree.getRequestMap();
         tree.process(collection);
-        this.collection = (Map<String, Object>) collectionRequest
-                .get("collection");
-        this.errors = (List) collectionRequest.get("errors");
-        this.warnings = (List) collectionRequest.get("warnings");
-        this.messages = (List) collectionRequest.get("messages");
+        if (collectionRequest.get("errors") != null)
+            this.errors.addAll((List) collectionRequest.get("errors"));
+        if (collectionRequest.get("warnings") != null)
+            this.warnings.addAll((List) collectionRequest.get("warnings"));
+        if (collectionRequest.get("messages") != null)
+            this.messages.addAll((List) collectionRequest.get("messages"));
         return this;
     }
-
-    //    public QuerySerializer setCollection(CollectionQueryBuilder2 collections) {
-    //        this.collection = (Map<String, Object>) collections.raw();
-    //        return this;
-    //    }
-    //
-    //    public QuerySerializer setDeprCollection(
-    //            CollectionQueryBuilder collections) {
-    //        this.collection = (Map<String, Object>) collections.raw();
-    //        return this;
-    //    }
 }
