diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java b/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
index e8a8c33..61f388b 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
@@ -1,62 +1,40 @@
 package de.ids_mannheim.korap.query.serialize;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
 import com.fasterxml.jackson.core.JsonGenerationException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-import de.ids_mannheim.korap.query.serialize.AbstractSyntaxTree;
-import de.ids_mannheim.korap.query.serialize.PoliqarpPlusTree;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
+/**
+ * @author bingel, hanl
+ */
 public class JsonGenerator {
 
-	ObjectMapper mapper;
-	AbstractSyntaxTree ast;
-	
-	public JsonGenerator() {
-		mapper = new ObjectMapper();
-	}
+    ObjectMapper mapper;
+    AbstractSyntaxTree ast;
+    private Serializer serializer;
 
-	/**
-	 * Runs the JsonGenerator 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 13/11/20, this must be either 'poliqarp' or 'poliqarpplus'. Some extra maven stuff needs to done to support CosmasII ('cosmas') [that maven stuff would be to tell maven how to build the cosmas grammar and where to find the classes]
-	 * @throws JsonGenerationException
-	 * @throws JsonMappingException
-	 * @throws IOException
-	 */
-	public void run(String query, String queryLanguage, String outFile)
-            throws JsonGenerationException, JsonMappingException, IOException {
-		if (queryLanguage.equals("poliqarp")) {
-			ast = new PoliqarpPlusTree(query);
-//		} else if (queryLanguage.equals("cosmas")) {
-//			ast = new CosmasTree(query);
-		} else if (queryLanguage.equals("poliqarpplus")) {
-			ast = new PoliqarpPlusTree(query);
-		} else {
-			throw new IllegalArgumentException(queryLanguage+ " is not a supported query language!");
-		}
-		Map<String, Object> requestMap = ast.getRequestMap();
-		mapper.writeValue(new File(outFile), requestMap);
-	}
-	
-	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		/*
-		 * just for testing...
+    public JsonGenerator() {
+        mapper = new ObjectMapper();
+        serializer = new Serializer();
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        /*
+         * just for testing...
 		 */
-		JsonGenerator jg = new JsonGenerator();
-		int i=0;
-		String[] queries;
-		if (args.length==0) {
-			queries = new String[] {
+        JsonGenerator jg = new JsonGenerator();
+        int i = 0;
+        String[] queries;
+        if (args.length == 0) {
+            queries = new String[]{
 					/*
 					 * negation
 					 * elemente
@@ -64,45 +42,96 @@
 					 * regex
 					 * & field_group
 					 */
-					"[base=foo]|([base=foo][base=bar])* meta author=Goethe&year=1815",
-					"([base=foo]|[base=bar])[base=foobar]",
-					"shrink({[base=Mann]})",
-					"shrink({[base=foo]}[orth=bar])",
-					"shrink(1:[base=Der]{1:[base=Mann]})",
-					
-					"[base=Katze]",
-					"[base!=Katze]",
-					"[!base=Katze]",
-					"[base=Katze&orth=Katzen]",
-					"[base=Katze][orth=und][orth=Hunde]",
-					"[!(base=Katze&orth=Katzen)]",
-					"contains(<np>,[base=Mann])",
-					"startswith(<np>,[!pos=Det])",
-					"'vers{2,3}uch'",
-					"[orth='vers.*ch']",
-					"[(base=bar|base=foo)&orth=foobar]",
-					
-				};
-		} else {
-			queries = new String[] {args[0]};
-		}
-		
-		for (String q : queries) {
-			i++;
-			try {
-				System.out.println(q);
-				jg.run(q, "poliqarp", System.getProperty("user.home")+"/bsp"+i+".json");
-				System.out.println();
-			} catch (NullPointerException npe) {
-				npe.printStackTrace();
-				System.out.println("null\n");
-			} catch (JsonGenerationException e) {
-				e.printStackTrace();
-			} catch (JsonMappingException e) {
-				e.printStackTrace();
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-	}
+                    "[base=foo]|([base=foo][base=bar])* meta author=Goethe&year=1815",
+                    "([base=foo]|[base=bar])[base=foobar]",
+                    "shrink({[base=Mann]})",
+                    "shrink({[base=foo]}[orth=bar])",
+                    "shrink(1:[base=Der]{1:[base=Mann]})",
+
+                    "[base=Katze]",
+                    "[base!=Katze]",
+                    "[!base=Katze]",
+                    "[base=Katze&orth=Katzen]",
+                    "[base=Katze][orth=und][orth=Hunde]",
+                    "[!(base=Katze&orth=Katzen)]",
+                    "contains(<np>,[base=Mann])",
+                    "startswith(<np>,[!pos=Det])",
+                    "'vers{2,3}uch'",
+                    "[orth='vers.*ch']",
+                    "[(base=bar|base=foo)&orth=foobar]",
+
+            };
+        } else {
+            queries = new String[]{args[0]};
+        }
+
+        for (String q : queries) {
+            i++;
+            try {
+                System.out.println(q);
+                jg.run(q, "poliqarp", System.getProperty("user.home") + "/bsp" + i + ".json");
+                System.out.println();
+            } catch (NullPointerException npe) {
+                npe.printStackTrace();
+                System.out.println("null\n");
+            } catch (JsonGenerationException e) {
+                e.printStackTrace();
+            } catch (JsonMappingException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * Runs the JsonGenerator 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 13/11/20, this must be either 'poliqarp' or 'poliqarpplus'. Some extra maven stuff needs to done to support CosmasII ('cosmas') [that maven stuff would be to tell maven how to build the cosmas grammar and where to find the classes]
+     * @throws JsonGenerationException
+     * @throws JsonMappingException
+     * @throws IOException
+     */
+    public void run(String query, String queryLanguage, String outFile)
+            throws JsonGenerationException, JsonMappingException, IOException {
+        if (queryLanguage.equals("poliqarp")) {
+            ast = new PoliqarpPlusTree(query);
+//		} else if (queryLanguage.equals("cosmas")) {
+//			ast = new CosmasTree(query);
+        } else if (queryLanguage.equals("poliqarpplus")) {
+            ast = new PoliqarpPlusTree(query);
+        } else {
+            throw new IllegalArgumentException(queryLanguage + " is not a supported query language!");
+        }
+        Map<String, Object> requestMap = ast.getRequestMap();
+        mapper.writeValue(new File(outFile), requestMap);
+    }
+
+    public String run(String query, String ql, List<String> meta,
+                      String cli, String cri, int cls, int crs, int page, int num) {
+        if (ql.equals("poliqarp")) {
+            ast = new PoliqarpPlusTree(query);
+//		} else if (queryLanguage.equals("cosmas")) {
+//			ast = new CosmasTree(query);
+        } else if (ql.equals("poliqarpplus")) {
+            ast = new PoliqarpPlusTree(query);
+        } else {
+            throw new IllegalArgumentException(ql + " is not a supported query language!");
+        }
+        Map<String, Object> requestMap = ast.getRequestMap();
+        try {
+            List<Map> meta_re = serializer.serializeResources(meta);
+            requestMap.put("meta", meta_re);
+            requestMap = serializer.addParameters(requestMap, page, num,
+                    cli, cri, cls, crs);
+            return mapper.writeValueAsString(requestMap);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
index 17b6392..c7d31f1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
@@ -64,7 +64,8 @@
     //todo: how to handle regex types?
     // only handles AND relation between query attributes and values!
     // value pair : pubdate=<date>, pubPlace=<place>, etc.
-    public List serializeQueries(Map<String, String> queries, TYPE type) {
+    public List<Map> serializeQueries(Map<String, String> queries, TYPE type) {
+        //single is redundant!
         boolean extend, single = true; //single = true;
         boolean multypes = queries.keySet().size() > 1;
         List<Map> metavalue;
@@ -80,8 +81,8 @@
                 break;
         }
 
-        List value = new LinkedList();
-        List<String> dates = new LinkedList<>();
+        List value = new ArrayList<>();
+        List<String> dates = new ArrayList<>();
         for (String key : queries.keySet()) {
             if (!multypes)
                 def_key = key;
@@ -115,10 +116,7 @@
 //            }
 
             Map term;
-            if (multypes)
-                term = types.createTerm(key, null, queries.get(key).trim(), null);
-            else
-                term = types.createTerm(def_key, null, queries.get(key).trim(), null);
+            term = types.createTerm(key, null, queries.get(key).trim(), null);
             value.add(term);
         }
 
@@ -166,7 +164,7 @@
             else
                 metavalue = Arrays.asList(types.createMetaFilter(group));
         }
-        return metavalue;
+        return new ArrayList<>(metavalue);
     }
 
     //todo: resource id must be added!
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java
deleted file mode 100644
index 1ed0737..0000000
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package de.ids_mannheim.korap.query.serialize;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author hanl
- * @date 05/12/2013
- */
-public class MetaSerializer {
-
-
-    private MetaQuerySerializer qs;
-    private MetaCollectionSerializer cs;
-    private ObjectMapper mapper;
-
-
-    public MetaSerializer() {
-        this.qs = new MetaQuerySerializer();
-        this.cs = new MetaCollectionSerializer();
-        this.mapper = new ObjectMapper();
-    }
-
-    public String serializeMeta(List m_queries) throws JsonProcessingException {
-        Map metas = new HashMap();
-        metas.put("meta", m_queries);
-        return mapper.writeValueAsString(metas);
-    }
-
-    public List<Map> serialzeResources(List<String> r_queries) throws IOException {
-        return cs.serialize(r_queries);
-    }
-
-    public List<Map> serializeQueries(Map<String, String> queries, MetaQuerySerializer.TYPE type) {
-        return qs.serializeQueries(queries, type);
-    }
-}
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaTypes.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaTypes.java
index 125ec1c..fc43a37 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaTypes.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaTypes.java
@@ -88,11 +88,13 @@
         return meta;
     }
 
+    //fixme, two digits!
     public String formatDate(long date, String format) {
         DateTime time = new DateTime(date);
+        String year, month, day;
         switch (format) {
             case YM:
-                String s = time.getYear() + "-" + time.getMonthOfYear();
+                String s = time.getYear() + "-" + time.getDayOfMonth();
                 return s;
             case YMD:
                 String s1 = time.getYear() + "-" + time.getMonthOfYear() + "-" + time.getDayOfMonth();
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Serializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Serializer.java
new file mode 100644
index 0000000..4cb32b9
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Serializer.java
@@ -0,0 +1,61 @@
+package de.ids_mannheim.korap.query.serialize;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @author hanl
+ * @date 05/12/2013
+ */
+public class Serializer {
+
+
+    private MetaQuerySerializer qs;
+    private MetaCollectionSerializer cs;
+    private ObjectMapper mapper;
+
+
+    public Serializer() {
+        this.qs = new MetaQuerySerializer();
+        this.cs = new MetaCollectionSerializer();
+        this.mapper = new ObjectMapper();
+    }
+
+    public String serializeMeta(List m_queries) throws JsonProcessingException {
+        Map metas = new HashMap();
+        metas.put("meta", m_queries);
+        return mapper.writeValueAsString(metas);
+    }
+
+    public List<Map> serializeResources(List<String> r_queries) throws IOException {
+        return cs.serialize(r_queries);
+    }
+
+    public List<Map> serializeQueries(Map<String, String> queries, MetaQuerySerializer.TYPE type) {
+        return qs.serializeQueries(queries, type);
+    }
+
+    public Map addParameters(Map request, int page, int num, String cli, String cri,
+                             int cls, int crs) {
+        Map ctx = new LinkedHashMap();
+        List left = new ArrayList();
+        left.add(cli);
+        left.add(cls);
+        List right = new ArrayList();
+        right.add(cri);
+        right.add(crs);
+        ctx.put("left", left);
+        ctx.put("right", right);
+
+        request.put("startPage", page);
+        request.put("count", num);
+        request.put("context", ctx);
+
+        return request;
+
+    }
+
+}
