diff --git a/pom.xml b/pom.xml
index d86dfaa..d238e66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,8 +53,6 @@
 		</repository>
 	</repositories>
 	<dependencies>
-		<!-- <dependency> <groupId>org.antlr</groupId> <artifactId>antlr4-runtime</artifactId> 
-			<version>4.2</version> </dependency> -->
 		<dependency>
 			<groupId>org.antlr</groupId>
 			<artifactId>antlr4-runtime</artifactId>
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/ClassRefCheck.java b/src/main/java/de/ids_mannheim/korap/query/object/ClassRefCheck.java
new file mode 100644
index 0000000..e19b0d4
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/object/ClassRefCheck.java
@@ -0,0 +1,11 @@
+package de.ids_mannheim.korap.query.object;
+
+public enum ClassRefCheck {
+    
+    INTERSECTS, EQUALS, UNEQUALS, INCLUDES, DISJOINT;
+    
+    @Override
+    public String toString() {
+        return "classRefCheck:"+name().toLowerCase();
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/ClassRefOp.java b/src/main/java/de/ids_mannheim/korap/query/object/ClassRefOp.java
new file mode 100644
index 0000000..0c8b934
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/object/ClassRefOp.java
@@ -0,0 +1,11 @@
+package de.ids_mannheim.korap.query.object;
+
+public enum ClassRefOp {
+
+    INVERSION, INTERSECTION, UNION, DELETE;
+
+    @Override
+    public String toString () {
+        return "classRefOp:" + name().toLowerCase();
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/KoralFrame.java b/src/main/java/de/ids_mannheim/korap/query/object/KoralFrame.java
new file mode 100644
index 0000000..5ac6e8c
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/object/KoralFrame.java
@@ -0,0 +1,19 @@
+package de.ids_mannheim.korap.query.object;
+
+public enum KoralFrame {
+
+    SUCCEDS("succeeds"), SUCCEDS_DIRECTLY("succeedsDirectly"), OVERLAPS_RIGHT("overlapsRight"), 
+    ALIGNS_RIGHT("alignsRight"), IS_WITHIN("isWithin"), STARTS_WITH("startsWith"), 
+    MATCHES("matches"), ALIGNS_LEFT("alignsLeft"), IS_AROUND("isAround"), ENDS_WITH("endsWith"),
+    OVERLAPS_LEFT("overlapsLeft"), PRECEEDS_DIRECTLY("precedesDirectly"), PRECEDES("precedes");
+    
+    private String value;
+    KoralFrame(String value) {
+        this.value = value;
+    }
+    
+    @Override
+    public String toString() {
+        return "frames:"+value;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/KoralGroup.java b/src/main/java/de/ids_mannheim/korap/query/object/KoralGroup.java
index 87d98e8..2e1b779 100644
--- a/src/main/java/de/ids_mannheim/korap/query/object/KoralGroup.java
+++ b/src/main/java/de/ids_mannheim/korap/query/object/KoralGroup.java
@@ -23,7 +23,7 @@
     private boolean inOrder = false;
     private List<KoralObject> operands;
     private List<KoralDistance> distances;
-    private List<Frame> frames;
+    private List<KoralFrame> frames;
     private KoralBoundary boundary;
     
 //    private int[] classIn;
@@ -68,11 +68,11 @@
         this.distances = distances;
     }
     
-    public List<Frame> getFrames() {
+    public List<KoralFrame> getFrames() {
 		return frames;
 	}
 
-	public void setFrames(List<Frame> frames) {
+	public void setFrames(List<KoralFrame> frames) {
 		this.frames = frames;
 	}
 
@@ -111,20 +111,20 @@
         return map;
     }
 
-    public enum Frame{
-		SUCCEDS("succeeds"), SUCCEDS_DIRECTLY("succeedsDirectly"), OVERLAPS_RIGHT("overlapsRight"), 
-		ALIGNS_RIGHT("alignsRight"), IS_WITHIN("isWithin"), STARTS_WITH("startsWith"), 
-		MATCHES("matches"), ALIGNS_LEFT("alignsLeft"), IS_AROUND("isAround"), ENDS_WITH("endsWith"),
-		OVERLAPS_LEFT("overlapsLeft"), PRECEEDS_DIRECTLY("precedesDirectly"), PRECEDES("precedes");
-		
-		private String value;
-		Frame(String value) {
-			this.value = value;
-		}
-		
-		@Override
-		public String toString() {
-			return "frame:"+value;
-		}
-	}
+//    public enum Frame{
+//		SUCCEDS("succeeds"), SUCCEDS_DIRECTLY("succeedsDirectly"), OVERLAPS_RIGHT("overlapsRight"), 
+//		ALIGNS_RIGHT("alignsRight"), IS_WITHIN("isWithin"), STARTS_WITH("startsWith"), 
+//		MATCHES("matches"), ALIGNS_LEFT("alignsLeft"), IS_AROUND("isAround"), ENDS_WITH("endsWith"),
+//		OVERLAPS_LEFT("overlapsLeft"), PRECEEDS_DIRECTLY("precedesDirectly"), PRECEDES("precedes");
+//		
+//		private String value;
+//		Frame(String value) {
+//			this.value = value;
+//		}
+//		
+//		@Override
+//		public String toString() {
+//			return "frame:"+value;
+//		}
+//	}
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/KoralOperation.java b/src/main/java/de/ids_mannheim/korap/query/object/KoralOperation.java
index d81557f..98dae3e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/object/KoralOperation.java
+++ b/src/main/java/de/ids_mannheim/korap/query/object/KoralOperation.java
@@ -5,7 +5,7 @@
  * 
  */
 public enum KoralOperation {
-    SEQUENCE, POSITION, DISJUNCTION, REPETITION, CLASS, MERGE, RELATION;
+    SEQUENCE, POSITION, DISJUNCTION, REPETITION, CLASS, MERGE, RELATION, FOCUS;
 
     @Override
     public String toString() {
diff --git a/src/main/java/de/ids_mannheim/korap/query/object/KoralType.java b/src/main/java/de/ids_mannheim/korap/query/object/KoralType.java
index 4992f43..beb76ab 100644
--- a/src/main/java/de/ids_mannheim/korap/query/object/KoralType.java
+++ b/src/main/java/de/ids_mannheim/korap/query/object/KoralType.java
@@ -1,24 +1,28 @@
 package de.ids_mannheim.korap.query.object;
 
-/** Definition of various types of KoralQuery building objects.
- *  
+/**
+ * Definition of various types of KoralQuery building objects.
+ * 
  * @author margaretha
  * 
  */
 public enum KoralType {
-    TERMGROUP("koral:termGroup"), TERM("koral:term"), TOKEN("koral:token"), SPAN(
-            "koral:span"), GROUP("koral:group"), BOUNDARY("koral:boundary"), RELATION(
-            "koral:relation"), DISTANCE("koral:distance"), REFERENCE(
-            "koral:reference");
+    TERMGROUP("koral:termGroup"), TERM("koral:term"), TOKEN("koral:token"), 
+    SPAN("koral:span"), GROUP("koral:group"), BOUNDARY("koral:boundary"), 
+    RELATION("koral:relation"), DISTANCE("koral:distance"), REFERENCE(
+    "koral:reference"), DOCUMENT("koral:doc"), DOCUMENTGROUP("koral:docGroup"),
+    COSMAS_DISTANCE("cosmas:distance");
 
     String value;
 
+
     KoralType (String value) {
         this.value = value;
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return value;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
index 98f6536..c4d0fa1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
+++ b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
@@ -10,11 +10,11 @@
 import de.ids_mannheim.korap.query.object.KoralBoundary;
 import de.ids_mannheim.korap.query.object.KoralGroup;
 import de.ids_mannheim.korap.query.object.KoralDistance;
+import de.ids_mannheim.korap.query.object.KoralFrame;
 import de.ids_mannheim.korap.query.object.KoralObject;
 import de.ids_mannheim.korap.query.object.KoralOperation;
 import de.ids_mannheim.korap.query.object.KoralSpan;
 import de.ids_mannheim.korap.query.object.KoralTerm;
-import de.ids_mannheim.korap.query.object.KoralGroup.Frame;
 import eu.clarin.sru.server.fcs.parser.ExpressionWildcard;
 import eu.clarin.sru.server.fcs.parser.QueryDisjunction;
 import eu.clarin.sru.server.fcs.parser.QueryGroup;
@@ -125,7 +125,7 @@
     private KoralGroup parseWithinQuery(QueryWithWithin queryNode)
             throws KoralException {
         KoralGroup koralGroup = new KoralGroup(KoralOperation.POSITION);
-        koralGroup.setFrames(Arrays.asList(Frame.IS_AROUND));
+        koralGroup.setFrames(Arrays.asList(KoralFrame.IS_AROUND));
 
         List<KoralObject> operands = new ArrayList<KoralObject>();
         operands.add(parseQueryNode(queryNode.getWithin()));
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
index 528d799..5a1c0b0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
@@ -17,9 +17,13 @@
 import org.antlr.v4.runtime.Lexer;
 import org.antlr.v4.runtime.ParserRuleContext;
 import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.commons.lang.math.Fraction;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
+import de.ids_mannheim.korap.query.object.KoralFrame;
+import de.ids_mannheim.korap.query.object.KoralOperation;
+import de.ids_mannheim.korap.query.object.KoralTermGroupRelation;
 import de.ids_mannheim.korap.query.parse.annis.AqlLexer;
 import de.ids_mannheim.korap.query.parse.annis.AqlParser;
 import de.ids_mannheim.korap.query.serialize.util.Antlr4DescriptiveErrorListener;
@@ -38,6 +42,7 @@
  * @see http://annis-tools.org/aql.html
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @author Eliza Margaretha (margaretha@ids-mannheim.de)
  * @version 0.3.0
  * @since 0.1.0
  */
@@ -392,7 +397,7 @@
         List<ParseTree> andTopExprs = getChildrenWithCat(node, "andTopExpr");
         if (andTopExprs.size() > 1) {
             LinkedHashMap<String, Object> topOr = KoralObjectGenerator
-                    .makeGroup("disjunction");
+                    .makeGroup(KoralOperation.DISJUNCTION);
             requestMap.put("query", topOr);
             objectStack.push(topOr);
         }
@@ -475,7 +480,7 @@
             }
             else {
                 LinkedHashMap<String, Object> termGroup = KoralObjectGenerator
-                        .makeTermGroup("and");
+                        .makeTermGroup(KoralTermGroupRelation.AND);
                 ArrayList<Object> operands = (ArrayList<Object>) termGroup
                         .get("operands");
                 for (ParseTree unaryTerm : unaryTermsForRef) {
@@ -634,9 +639,9 @@
                     || reltype.equals("commonancestor")) {
                 // make an (outer) group and an inner group containing the dummy 
                 // node or previous relations
-                group = KoralObjectGenerator.makeGroup("relation");
+                group = KoralObjectGenerator.makeGroup(KoralOperation.RELATION);
                 LinkedHashMap<String, Object> innerGroup = KoralObjectGenerator
-                        .makeGroup("relation");
+                        .makeGroup(KoralOperation.RELATION);
                 LinkedHashMap<String, Object> relation = KoralObjectGenerator
                         .makeRelation();
                 LinkedHashMap<String, Object> term = KoralObjectGenerator
@@ -701,14 +706,15 @@
                     groupType = "relation";
                 }
                 if (groupType.equals("relation")
-                        || groupType.equals("treeRelation")) {
-                    group = KoralObjectGenerator.makeGroup(groupType);
+//                        || groupType.equals("treeRelation")
+                    ) {
+                    group = KoralObjectGenerator.makeGroup(KoralOperation.RELATION);
                     LinkedHashMap<String, Object> relation = new LinkedHashMap<String, Object>();
                     putAllButGroupType(relation, operatorGroup);
                     group.put("relation", relation);
                 }
                 else if (groupType.equals("sequence")) {
-                    group = KoralObjectGenerator.makeGroup(groupType);
+                    group = KoralObjectGenerator.makeGroup(KoralOperation.SEQUENCE);
                     putAllButGroupType(group, operatorGroup);
                 }
                 else if (groupType.equals("position")) {
@@ -725,10 +731,12 @@
                 ParseTree rightChildSpec = getFirstChildWithCat(node
                         .getChild(i).getChild(0), "@r");
                 if (leftChildSpec != null || rightChildSpec != null) {
-                    String frame = (leftChildSpec != null) ? "frames:startsWith"
-                            : "frames:endsWith";
+                    KoralFrame frame = (leftChildSpec != null) ? KoralFrame.STARTS_WITH
+                            : KoralFrame.ENDS_WITH;
+                    ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
+                    frames.add(frame);
                     LinkedHashMap<String, Object> positionGroup = KoralObjectGenerator
-                            .makePosition(new String[] { frame });
+                            .makePosition(frames);
                     operand2 = KoralObjectGenerator.wrapInClass(operand2,
                             ++classCounter + 128);
                     ((ArrayList<Object>) positionGroup.get("operands"))
@@ -866,7 +874,7 @@
                     term = edgeSpec;
                 }
                 else {
-                    term = KoralObjectGenerator.makeTermGroup("and");
+                    term = KoralObjectGenerator.makeTermGroup(KoralTermGroupRelation.AND);
                     ArrayList<Object> termGroupOperands = (ArrayList<Object>) term
                             .get("operands");
                     termGroupOperands.add(edgeSpec);
@@ -923,30 +931,31 @@
         }
         else if (operator.equals("spanrelation")) {
             String reltype = operatorNode.getChild(0).toStringTree(parser);
-            String[] frames = new String[] {};
+            ArrayList<KoralFrame> frames = new ArrayList<>();
             switch (reltype) {
                 case "_=_":
-                    frames = new String[] { "frames:matches" };
+                    frames.add(KoralFrame.MATCHES);
                     break;
                 case "_l_":
-                    frames = new String[] { "frames:startsWith",
-                            "frames:matches" };
+                    frames.add(KoralFrame.STARTS_WITH);
+                    frames.add(KoralFrame.MATCHES);
                     break;
                 case "_r_":
-                    frames = new String[] { "frames:endsWith", "frames:matches" };
+                    frames.add(KoralFrame.ENDS_WITH);
+                    frames.add(KoralFrame.MATCHES);
                     break;
                 case "_i_":
-                    frames = new String[] { "frames:isAround" };
+                    frames.add(KoralFrame.IS_AROUND);
                     break;
                 case "_o_":
-                    frames = new String[] { "frames:overlapsLeft",
-                            "frames:overlapsRight" };
+                    frames.add(KoralFrame.OVERLAPS_LEFT);
+                    frames.add(KoralFrame.OVERLAPS_RIGHT);
                     break;
                 case "_ol_":
-                    frames = new String[] { "frames:overlapsLeft" };
+                    frames.add(KoralFrame.OVERLAPS_LEFT);
                     break;
                 case "_or_":
-                    frames = new String[] { "frames:overlapsRight" };
+                    frames.add(KoralFrame.OVERLAPS_RIGHT);
                     break;
             }
             relation = KoralObjectGenerator.makePosition(frames);
@@ -989,7 +998,7 @@
             return parseEdgeAnno(annos.get(0));
         else {
             LinkedHashMap<String, Object> termGroup = KoralObjectGenerator
-                    .makeTermGroup("and");
+                    .makeTermGroup(KoralTermGroupRelation.AND);
             ArrayList<Object> operands = (ArrayList<Object>) termGroup
                     .get("operands");
             for (ParseTree anno : annos) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
index ae544a1..4667430 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
@@ -1,5 +1,6 @@
 package de.ids_mannheim.korap.query.serialize;
 
+import de.ids_mannheim.korap.query.object.KoralTermGroupRelation;
 import de.ids_mannheim.korap.query.parse.collection.CollectionQueryLexer;
 import de.ids_mannheim.korap.query.parse.collection.CollectionQueryParser;
 import de.ids_mannheim.korap.query.serialize.util.Antlr4DescriptiveErrorListener;
@@ -519,8 +520,12 @@
                 rightOp = node.getChild(node.getChildCount() - 2);
             // establish boolean relation
             ParseTree boolOp = getFirstChildWithCat(node, "booleanOp");
-            String operator = boolOp.getText().equals("&") ? "and" : "or";
-            termGroup = KoralObjectGenerator.makeTermGroup(operator);
+            if (boolOp.getText().equals("&")){
+                termGroup = KoralObjectGenerator.makeTermGroup(KoralTermGroupRelation.AND);
+            }
+            else {
+                termGroup = KoralObjectGenerator.makeTermGroup(KoralTermGroupRelation.OR);
+            }
             ArrayList<Object> operands = (ArrayList<Object>) termGroup
                     .get("operands");
             // recursion with left/right operands
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
index 0d5980a..c3b31e2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
@@ -1,8 +1,16 @@
 package de.ids_mannheim.korap.query.serialize;
 
+import de.ids_mannheim.korap.query.object.ClassRefCheck;
+import de.ids_mannheim.korap.query.object.ClassRefOp;
+import de.ids_mannheim.korap.query.object.KoralFrame;
+import de.ids_mannheim.korap.query.object.KoralMatchOperator;
+import de.ids_mannheim.korap.query.object.KoralOperation;
+import de.ids_mannheim.korap.query.object.KoralTermGroupRelation;
+import de.ids_mannheim.korap.query.object.KoralType;
 import de.ids_mannheim.korap.query.parse.cosmas.c2psLexer;
 import de.ids_mannheim.korap.query.parse.cosmas.c2psParser;
 import de.ids_mannheim.korap.query.serialize.util.Antlr3DescriptiveErrorListener;
+import de.ids_mannheim.korap.query.serialize.util.Converter;
 import de.ids_mannheim.korap.query.serialize.util.KoralObjectGenerator;
 import de.ids_mannheim.korap.query.serialize.util.ResourceMapper;
 import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
@@ -26,6 +34,7 @@
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
  * @author Nils Diewald (diewald@ids-mannheim.de)
+ * @author Eliza Margaretha (margaretha@ids-mannheim.de)
  * @version 0.3
  */
 public class Cosmas2QueryProcessor extends Antlr3AbstractQueryProcessor {
@@ -87,8 +96,8 @@
      * be in a sequence with any number of other nodes in this list)
      */
     private final List<String> sequentiableNodeTypes = Arrays
-            .asList(new String[] { "OPWF", "OPLEM", "OPMORPH", "OPBEG",
-                    "OPEND", "OPIN", "OPBED", "OPELEM", "OPOR", "OPAND" });
+            .asList(new String[] { "OPWF", "OPLEM", "OPMORPH", "OPBEG", "OPEND",
+                    "OPIN", "OPBED", "OPELEM", "OPOR", "OPAND" });
     /**
      * Keeps track of sequenced nodes, i.e. nodes that implicitly
      * govern a sequence, as in (C2PQ (OPWF der) (OPWF Mann)). This is
@@ -173,8 +182,8 @@
                 if (node == parent.getChild(0)) {
                     nodeHasSequentiableSiblings = false;
                     for (int i = 1; i < parent.getChildCount(); i++) {
-                        if (sequentiableNodeTypes.contains(getNodeCat(parent
-                                .getChild(i)))) {
+                        if (sequentiableNodeTypes
+                                .contains(getNodeCat(parent.getChild(i)))) {
                             nodeHasSequentiableSiblings = true;
                             continue;
                         }
@@ -182,7 +191,7 @@
                     if (nodeHasSequentiableSiblings) {
                         // Step I: create sequence
                         LinkedHashMap<String, Object> sequence = KoralObjectGenerator
-                                .makeGroup("sequence");
+                                .makeGroup(KoralOperation.SEQUENCE);
                         // push sequence on object stack but don't
                         // increment stackedObjects counter since
                         // we've got to wait until the parent node is
@@ -387,8 +396,10 @@
                 submatchOperands.add(conditionGroup);
             }
             else if (conditionCount < conditionGroups.size()) {
+                ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
+                frames.add(KoralFrame.MATCHES);
                 LinkedHashMap<String, Object> matchesGroup = KoralObjectGenerator
-                        .makePosition(new String[] { "frames:matches" });
+                        .makePosition(frames);
                 @SuppressWarnings("unchecked")
                 ArrayList<Object> matchesOperands = (ArrayList<Object>) matchesGroup
                         .get("operands");
@@ -425,7 +436,7 @@
         LinkedHashMap<String, Object> group = KoralObjectGenerator
                 .makeReference(classCounter + 128);
         LinkedHashMap<String, Object> classRefCheck = KoralObjectGenerator
-                .makeClassRefOp("classRefOp:inversion", classRef,
+                .makeClassRefOp(ClassRefOp.INVERSION, classRef,
                         classCounter + 128);
         ArrayList<Object> operands = new ArrayList<Object>();
         operands.add(classRefCheck);
@@ -467,7 +478,7 @@
         // LinkedHashMap<String, Object> posgroup =
         // makePosition(null);
         LinkedHashMap<String, Object> posGroup = KoralObjectGenerator
-                .makeGroup("position");
+                .makeGroup(KoralOperation.POSITION);
         LinkedHashMap<String, Object> positionOptions;
         // posgroup
         if (nodeCat.equals("OPIN")) {
@@ -487,7 +498,7 @@
                 .push((ArrayList<Object>) posGroup.get("operands"));
         stackedObjects++;
         // Step II: wrap in classRefCheck and/or focus and decide where to put
-        ArrayList<String> check = (ArrayList<String>) positionOptions
+        ArrayList<ClassRefCheck> check = (ArrayList<ClassRefCheck>) positionOptions
                 .get("classRefCheck");
         Integer[] classIn = new Integer[] { classCounter + 128 - 2,
                 classCounter + 128 - 1 };
@@ -503,8 +514,7 @@
         }
         LinkedHashMap<String, Object> focusGroup = null;
         if ((boolean) positionOptions.get("matchall") == true) {
-            focusGroup = KoralObjectGenerator.makeClassRefOp(
-                    "classRefOp:delete",
+            focusGroup = KoralObjectGenerator.makeClassRefOp(ClassRefOp.DELETE,
                     new Integer[] { 128 + classCounter++ }, 128 + classCounter);
             ((ArrayList<Object>) focusGroup.get("operands")).add(topGroup);
         }
@@ -517,7 +527,7 @@
         if (positionOptions.containsKey("grouping")) {
             if (positionOptions.get("grouping").equals(true)) {
                 LinkedHashMap<String, Object> mergeOperation = KoralObjectGenerator
-                        .makeGroup("merge");
+                        .makeGroup(KoralOperation.MERGE);
                 ArrayList<Object> mergeOperands = (ArrayList<Object>) mergeOperation
                         .get("operands");
                 mergeOperands.add(focusGroup);
@@ -536,7 +546,7 @@
         Tree dist_list = prox_opts.getChild(1);
         // Step I: create group
         LinkedHashMap<String, Object> group = KoralObjectGenerator
-                .makeGroup("sequence");
+                .makeGroup(KoralOperation.SEQUENCE);
 
         ArrayList<Object> constraints = new ArrayList<Object>();
         boolean exclusion = typ.getChild(0).toStringTree().equals("EXCL");
@@ -584,7 +594,7 @@
                     .makeDistance(meas, min, max);
             // override @type, min/max to be treated according to 
             // Cosmas particularities
-            distance.put("@type", "cosmas:distance");
+            distance.put("@type", KoralType.COSMAS_DISTANCE.toString());
             if (exclusion) {
                 distance.put("exclude", true);
             }
@@ -608,8 +618,8 @@
         LinkedHashMap<String, Object> embeddedSequence = group;
 
         if (!(openNodeCats.get(1).equals("OPBEG")
-                || openNodeCats.get(1).equals("OPEND") || inOPALL || openNodeCats
-                .get(1).equals("OPNHIT"))) {
+                || openNodeCats.get(1).equals("OPEND") || inOPALL
+                || openNodeCats.get(1).equals("OPNHIT"))) {
             wrapOperandInClass(node, 1, 128 + classCounter);
             wrapOperandInClass(node, 2, 128 + classCounter);
             // Deactivated, uncomment to wrap sequence in reference.
@@ -669,7 +679,7 @@
     private void processOPOR (Tree node) {
         // Step I: create group
         LinkedHashMap<String, Object> disjunction = KoralObjectGenerator
-                .makeGroup("disjunction");
+                .makeGroup(KoralOperation.DISJUNCTION);
         disjunction.put("inOrder", false); // Order is not important 
         objectStack.push(disjunction);
         stackedObjects++;
@@ -682,7 +692,7 @@
         // Step I: create group
         String nodeCat = getNodeCat(node);
         LinkedHashMap<String, Object> distgroup = KoralObjectGenerator
-                .makeGroup("sequence");
+                .makeGroup(KoralOperation.SEQUENCE);
         distgroup.put("inOrder", false); // Order is not important 
         ArrayList<Object> distances = new ArrayList<Object>();
         LinkedHashMap<String, Object> zerodistance = KoralObjectGenerator
@@ -709,46 +719,43 @@
     }
 
 
-	// TODO: The handling of attributes vs. element names is somehow disputable ...
+    // TODO: The handling of attributes vs. element names is somehow disputable ...
     @SuppressWarnings("unchecked")
     private void processOPELEM (Tree node) {
         // Step I: create element
         LinkedHashMap<String, Object> span = KoralObjectGenerator.makeSpan();
         if (node.getChild(0).toStringTree().equals("EMPTY")) {
-            addError(
-                    StatusCodes.MALFORMED_QUERY,
-                    "Empty #ELEM() operator."
-                            + " Please specify a valid element key (like 's' for sentence).");
+            addError(StatusCodes.MALFORMED_QUERY, "Empty #ELEM() operator."
+                    + " Please specify a valid element key (like 's' for sentence).");
             return;
         }
         else {
             int elname = 0;
             Tree elnameNode = getFirstChildWithCat(node, "ELNAME");
-			/*
-			// TODO: This is identical to processOPMORPH
-			String wordOrRegex = "\\w+|\".+?\"";
-			Pattern p = Pattern.compile("((\\w+)/)?((\\w*)(!?=))?(" + wordOrRegex
-										+ ")(:(" + wordOrRegex + "))?");
-			*/
+            /*
+            // TODO: This is identical to processOPMORPH
+            String wordOrRegex = "\\w+|\".+?\"";
+            Pattern p = Pattern.compile("((\\w+)/)?((\\w*)(!?=))?(" + wordOrRegex
+            							+ ")(:(" + wordOrRegex + "))?");
+            */
 
             if (elnameNode != null) {
-				/*
+                /*
                 span.put("key", elnameNode.getChild(0).toStringTree()
                         .toLowerCase());
-				*/
-				LinkedHashMap<String, Object> fm =
-					termToFieldMap(elnameNode.getChild(0).toStringTree());
+                */
+                LinkedHashMap<String, Object> fm = termToFieldMap(
+                        elnameNode.getChild(0).toStringTree());
 
-				if (fm == null)
-					return;
+                if (fm == null)
+                    return;
 
-				// Workaround for things like #ELEM(S) to become #ELEM(s)
-				if (fm.get("foundry") == null &&
-					fm.get("layer") == null &&
-					fm.get("key") != null) {
-					fm.put("key", fm.get("key").toString().toLowerCase());
-				};
-				span.put("wrap", fm);
+                // Workaround for things like #ELEM(S) to become #ELEM(s)
+                if (fm.get("foundry") == null && fm.get("layer") == null
+                        && fm.get("key") != null) {
+                    fm.put("key", fm.get("key").toString().toLowerCase());
+                };
+                span.put("wrap", fm);
                 elname = 1;
 
             }
@@ -766,7 +773,7 @@
                  * sub-group).
                  */
                 LinkedHashMap<String, Object> termGroup = KoralObjectGenerator
-                        .makeTermGroup("and");
+                        .makeTermGroup(KoralTermGroupRelation.AND);
                 ArrayList<Object> termGroupOperands = (ArrayList<Object>) termGroup
                         .get("operands");
                 for (int i = elname; i < node.getChildCount(); i++) {
@@ -783,13 +790,14 @@
                         }
                         term.put("layer", translateMorph(layer));
                         term.put("key", attrNode.getChild(1).toStringTree());
-                        String match = getNodeCat(attrNode).equals("EQ") ? "eq"
-                                : "ne";
-                        term.put("match", "match:" + match);
+                        KoralMatchOperator match = getNodeCat(attrNode)
+                                .equals("EQ") ? KoralMatchOperator.EQUALS
+                                        : KoralMatchOperator.NOT_EQUALS;
+                        term.put("match", match.toString());
                     }
                     else {
                         LinkedHashMap<String, Object> subTermGroup = KoralObjectGenerator
-                                .makeTermGroup("and");
+                                .makeTermGroup(KoralTermGroupRelation.AND);
                         ArrayList<Object> subTermGroupOperands = (ArrayList<Object>) subTermGroup
                                 .get("operands");
                         int j;
@@ -803,10 +811,12 @@
                                 layer = splitted[1];
                             }
                             term.put("layer", translateMorph(layer));
-                            term.put("key", attrNode.getChild(j).toStringTree());
-                            String match = getNodeCat(attrNode).equals("EQ") ? "eq"
-                                    : "ne";
-                            term.put("match", "match:" + match);
+                            term.put("key",
+                                    attrNode.getChild(j).toStringTree());
+                            KoralMatchOperator match = getNodeCat(attrNode)
+                                    .equals("EQ") ? KoralMatchOperator.EQUALS
+                                            : KoralMatchOperator.NOT_EQUALS;
+                            term.put("match", match.toString());
                             if (node.getChildCount() == elname + 1) {
                                 termGroupOperands.add(term);
                             }
@@ -828,13 +838,13 @@
                             .get(0);
                 }
 
-				// TODO: This should be improved ...
-				if (elname == 0) {
-					span.put("wrap", termGroup);
-				}
-				else {
-					span.put("attr", termGroup);
-				}
+                // TODO: This should be improved ...
+                if (elname == 0) {
+                    span.put("wrap", termGroup);
+                }
+                else {
+                    span.put("attr", termGroup);
+                }
             }
         }
         // Step II: decide where to put
@@ -852,21 +862,21 @@
 
         for (String morphterm : morphterms) {
 
-			fieldMap = termToFieldMap(morphterm);
-			if (fieldMap == null) {
-				return;
-			};
-			
+            fieldMap = termToFieldMap(morphterm);
+            if (fieldMap == null) {
+                return;
+            };
+
             terms.add(fieldMap);
         }
-		
+
         if (morphterms.length == 1) {
             token.put("wrap", fieldMap);
         }
-		
+
         else {
             LinkedHashMap<String, Object> termGroup = KoralObjectGenerator
-                    .makeTermGroup("and");
+                    .makeTermGroup(KoralTermGroupRelation.AND);
             termGroup.put("operands", terms);
             token.put("wrap", termGroup);
         }
@@ -912,10 +922,10 @@
 
         // negate field (see above)
         if (negate) {
-            fieldMap.put("match", "match:ne");
+            fieldMap.put("match", KoralMatchOperator.NOT_EQUALS.toString());
         }
         else {
-            fieldMap.put("match", "match:eq");
+            fieldMap.put("match", KoralMatchOperator.EQUALS.toString());
         }
         // Step II: decide where to put
         if (!hasChild(node, "TPOS")) {
@@ -986,16 +996,26 @@
 
     @SuppressWarnings("unchecked")
     /**
-     * Processes individual position conditions as provided in the OPTS node under the OPBEG node.
-     * #BEG allows to specify position constrains that apply to the beginning or the end of the subquery X.
-     * E.g., in #BEG(X, tpos/tpos), the 'tpos' constraints before the slash indicate conditions that apply 
-     * to the beginning of X, those after the slash are conditions that apply to the end of X.
-     * See the official C-II documentation for more details. <br/><br/>
+     * Processes individual position conditions as provided in the
+     * OPTS node under the OPBEG node.
+     * #BEG allows to specify position constrains that apply to the
+     * beginning or the end of the subquery X.
+     * E.g., in #BEG(X, tpos/tpos), the 'tpos' constraints before the
+     * slash indicate conditions that apply
+     * to the beginning of X, those after the slash are conditions
+     * that apply to the end of X.
+     * See the official C-II documentation for more details.
+     * <br/><br/>
      * What's important here is what follows: <br/>
-     * Assume the query #BED(der Mann, sa/pa). This means that <b>the beginning<b/> of "der Mann" stands at
-     * the beginning of a sentence and that <b>the end</b> (because this constraint comes after the slash) stands at the 
-     * beginning of a paragraph. The "end" means the last item, here "Mann", so this token comes at the beginning
-     * of a paragraph. To capture this, we choose spanRefs: The last item of X matches the first item of the span (here: P). 
+     * Assume the query #BED(der Mann, sa/pa). This means that <b>the
+     * beginning<b/> of "der Mann" stands at
+     * the beginning of a sentence and that <b>the end</b> (because
+     * this constraint comes after the slash) stands at the
+     * beginning of a paragraph. The "end" means the last item, here
+     * "Mann", so this token comes at the beginning
+     * of a paragraph. To capture this, we choose spanRefs: The last
+     * item of X matches the first item of the span (here: P).
+     * 
      * @param cond
      * @param distributedOperands
      * @param mode
@@ -1005,7 +1025,7 @@
             ArrayList<Object> distributedOperands, String mode) {
         boolean negated = false;
         String elem; // the 'span' (s/p/t)
-        String position = "frames:matches"; // default
+        KoralFrame position = KoralFrame.MATCHES; // default
         // spanRef to be used for the element ('span')
         Integer[] elemSpanRef = null;
         // spanRef to be used for the subquery X
@@ -1026,7 +1046,7 @@
         // we need to define spanRefs
         if (mode.equals("beg")) {
             if (nodeString.equals("a")) {
-                position = "frames:startsWith";
+                position = KoralFrame.STARTS_WITH;
             }
             else if (nodeString.equals("e")) {
                 hitSpanRef = new Integer[] { 0, 1 };
@@ -1035,7 +1055,7 @@
         }
         else if (mode.equals("end")) {
             if (nodeString.equals("e")) {
-                position = "frames:endsWith";
+                position = KoralFrame.ENDS_WITH;
             }
             else if (nodeString.equals("a")) {
                 hitSpanRef = new Integer[] { 0, 1 };
@@ -1044,8 +1064,10 @@
         }
         // Create the position group and add the span and the subquery
         // as operands, possibly wrapped in spanRefs
+        ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
+        frames.add(position);
         LinkedHashMap<String, Object> positionGroup = KoralObjectGenerator
-                .makePosition(new String[] { position });
+                .makePosition(frames);
         if (negated)
             positionGroup.put("exclude", true);
         ArrayList<Object> posOperands = new ArrayList<Object>();
@@ -1058,7 +1080,7 @@
         objectStack.push(classGroup);
         if (hitSpanRef != null) {
             LinkedHashMap<String, Object> spanRefAroundHit = KoralObjectGenerator
-                    .makeSpanReference(hitSpanRef, "focus");
+                    .makeSpanReference(hitSpanRef, KoralOperation.FOCUS);
             ((ArrayList<Object>) spanRefAroundHit.get("operands"))
                     .add(classGroup);
             // re-assign after wrapping classGroup in spanRef
@@ -1066,7 +1088,7 @@
         }
         if (elemSpanRef != null) {
             LinkedHashMap<String, Object> spanRefAroundSpan = KoralObjectGenerator
-                    .makeSpanReference(elemSpanRef, "focus");
+                    .makeSpanReference(elemSpanRef, KoralOperation.FOCUS);
             ((ArrayList<Object>) spanRefAroundSpan.get("operands")).add(span);
             // re-assign after wrapping span in spanRef
             span = spanRefAroundSpan;
@@ -1084,46 +1106,46 @@
         Tree groupnode = getFirstChildWithCat(node, "GROUP");
         boolean negatePosition = false;
         LinkedHashMap<String, Object> posOptions = new LinkedHashMap<String, Object>();
-        ArrayList<String> positions = new ArrayList<String>();
-        ArrayList<String> classRefCheck = new ArrayList<String>();
+        ArrayList<KoralFrame> positions = new ArrayList<KoralFrame>();
+        ArrayList<ClassRefCheck> classRefCheck = new ArrayList<ClassRefCheck>();
         posOptions.put("matchall", false);
         String posOption = null;
         if (posnode != null) {
             posOption = posnode.getChild(0).toStringTree();
             switch (posOption) {
                 case "L":
-                    positions.add("frames:startsWith");
-                    positions.add("frames:matches");
+                    positions.add(KoralFrame.STARTS_WITH);
+                    positions.add(KoralFrame.MATCHES);
                     //                    classRefCheck.add("classRefCheck:includes");
                     break;
                 case "R":
-                    positions.add("frames:endsWith");
-                    positions.add("frames:matches");
+                    positions.add(KoralFrame.ENDS_WITH);
+                    positions.add(KoralFrame.MATCHES);
                     //                    classRefCheck.add("classRefCheck:includes");
                     break;
                 case "F":
-                    positions.add("frames:matches");
+                    positions.add(KoralFrame.MATCHES);
                     //                    classRefCheck.add("classRefCheck:includes");
                     break;
                 case "FE":
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:equals");
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.EQUALS);
                     break;
                 case "FI":
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:unequals");
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.UNEQUALS);
                     //                    classRefCheck.add("classRefCheck:includes");
                     break;
                 case "N":
-                    positions.add("frames:contains");
+                    positions.add(KoralFrame.IS_AROUND);
                     //                    classRefCheck.add("classRefCheck:includes");
                     break;
             }
         }
         else {
-            classRefCheck.add("classRefCheck:includes");
+            classRefCheck.add(ClassRefCheck.INCLUDES);
         }
-        posOptions.put("frames", positions);
+        posOptions.put("frames", Converter.enumListToStringList(positions));
         posOptions.put("classRefCheck", classRefCheck);
         if (exclnode != null) {
             if (exclnode.getChild(0).toStringTree().equals("YES")) {
@@ -1164,48 +1186,48 @@
         Tree exclnode = getFirstChildWithCat(node, "EXCL");
         Tree groupnode = getFirstChildWithCat(node, "GROUP");
         LinkedHashMap<String, Object> posOptions = new LinkedHashMap<String, Object>();
-        ArrayList<String> positions = new ArrayList<String>();
-        ArrayList<String> classRefCheck = new ArrayList<String>();
+        ArrayList<KoralFrame> positions = new ArrayList<KoralFrame>();
+        ArrayList<ClassRefCheck> classRefCheck = new ArrayList<ClassRefCheck>();
         posOptions.put("matchall", false);
         String posOption = null;
         if (posnode != null) {
             posOption = posnode.getChild(0).toStringTree();
             switch (posOption) {
                 case "L":
-                    positions.add("frames:startsWith");
-                    positions.add("frames:overlapsLeft");
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:intersects");
+                    positions.add(KoralFrame.STARTS_WITH);
+                    positions.add(KoralFrame.OVERLAPS_LEFT);
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.INTERSECTS);
                     break;
                 case "R":
-                    positions.add("frames:endsWith");
-                    positions.add("frames:overlapsRight");
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:intersects");
+                    positions.add(KoralFrame.ENDS_WITH);
+                    positions.add(KoralFrame.OVERLAPS_RIGHT);
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.INTERSECTS);
                     break;
                 case "F":
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:intersects");
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.INTERSECTS);
                     break;
                 case "FE":
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:equals");
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.EQUALS);
                     break;
                 case "FI":
-                    positions.add("frames:matches");
-                    classRefCheck.add("classRefCheck:unequals");
+                    positions.add(KoralFrame.MATCHES);
+                    classRefCheck.add(ClassRefCheck.UNEQUALS);
                     break;
                 case "X":
-                    positions.add("frames:contains");
-                    classRefCheck.add("classRefCheck:intersects");
+                    positions.add(KoralFrame.IS_AROUND);
+                    classRefCheck.add(ClassRefCheck.INTERSECTS);
                     break;
             }
         }
         else {
-            classRefCheck.add("classRefCheck:intersects");
+            classRefCheck.add(ClassRefCheck.INTERSECTS);
         }
 
-        posOptions.put("frames", positions);
+        posOptions.put("frames", Converter.enumListToStringList(positions));
         posOptions.put("classRefCheck", classRefCheck);
         if (exclnode != null) {
             if (exclnode.getChild(0).toStringTree().equals("YES")) {
@@ -1244,8 +1266,8 @@
             LinkedHashMap<String, Object>[] wrapCascade) {
         int i;
         for (i = 0; i < wrapCascade.length - 1; i++) {
-            ArrayList<Object> containerOperands = (ArrayList<Object>) wrapCascade[i + 1]
-                    .get("operands");
+            ArrayList<Object> containerOperands = (ArrayList<Object>) wrapCascade[i
+                    + 1].get("operands");
             containerOperands.add(0, wrapCascade[i]);
         }
         return wrapCascade[i];
@@ -1303,64 +1325,65 @@
         return rewrittenQuery;
     }
 
-	private LinkedHashMap<String, Object> termToFieldMap (String term) {
+
+    private LinkedHashMap<String, Object> termToFieldMap (String term) {
 
         // regex group #2 is foundry, #4 layer, #5 operator,
         // #6 key, #8 value
         String wordOrRegex = "\\w+|\".+?\"";
-		// TODO: Should be initialized globally
+        // TODO: Should be initialized globally
         Pattern p = Pattern.compile("((\\w+)/)?((\\w*)(!?=))?(" + wordOrRegex
                 + ")(:(" + wordOrRegex + "))?");
         Matcher m;
 
-		m = p.matcher(term);
-		if (!m.matches()) {
-			addError(StatusCodes.INCOMPATIBLE_OPERATOR_AND_OPERAND,
-					 "Something went wrong parsing the argument in MORPH() or #ELEM().");
-			requestMap.put("query", new LinkedHashMap<String, Object>());
-			return null;
-		};
+        m = p.matcher(term);
+        if (!m.matches()) {
+            addError(StatusCodes.INCOMPATIBLE_OPERATOR_AND_OPERAND,
+                    "Something went wrong parsing the argument in MORPH() or #ELEM().");
+            requestMap.put("query", new LinkedHashMap<String, Object>());
+            return null;
+        };
 
         LinkedHashMap<String, Object> fieldMap = null;
-		fieldMap = KoralObjectGenerator.makeTerm();
+        fieldMap = KoralObjectGenerator.makeTerm();
 
-		if (m.group(2) != null)
-			fieldMap.put("foundry", m.group(2));
-		if (m.group(4) != null)
-			fieldMap.put("layer", m.group(4));
-		if (m.group(5) != null) {
-			if ("!=".equals(m.group(5)))
-				negate = !negate;
-		}
-		if (m.group(6) != null) {
-			String key = m.group(6);
-			if (key.startsWith("\"") && key.endsWith("\"")) {
-				key = key.substring(1, key.length() - 1);
-				fieldMap.put("type", "type:regex");
-			}
-			fieldMap.put("key", key);
-		}
+        if (m.group(2) != null)
+            fieldMap.put("foundry", m.group(2));
+        if (m.group(4) != null)
+            fieldMap.put("layer", m.group(4));
+        if (m.group(5) != null) {
+            if ("!=".equals(m.group(5)))
+                negate = !negate;
+        }
+        if (m.group(6) != null) {
+            String key = m.group(6);
+            if (key.startsWith("\"") && key.endsWith("\"")) {
+                key = key.substring(1, key.length() - 1);
+                fieldMap.put("type", "type:regex");
+            }
+            fieldMap.put("key", key);
+        }
 
-		if (m.group(8) != null) {
-			String value = m.group(8);
-			if (value.startsWith("\"") && value.endsWith("\"")) {
-				value = value.substring(1, value.length() - 1);
-				fieldMap.put("type", "type:regex");
-			}
-			fieldMap.put("value", value);
-		}
+        if (m.group(8) != null) {
+            String value = m.group(8);
+            if (value.startsWith("\"") && value.endsWith("\"")) {
+                value = value.substring(1, value.length() - 1);
+                fieldMap.put("type", "type:regex");
+            }
+            fieldMap.put("value", value);
+        }
 
-		// negate field (see above)
-		if (negate) {
-			fieldMap.put("match", "match:ne");
-		}
-		else {
-			fieldMap.put("match", "match:eq");
-		};
-		return fieldMap;
-	};
+        // negate field (see above)
+        if (negate) {
+            fieldMap.put("match", KoralMatchOperator.NOT_EQUALS.toString());
+        }
+        else {
+            fieldMap.put("match", KoralMatchOperator.EQUALS.toString());
+        };
+        return fieldMap;
+    };
 
-	
+
     private Tree parseCosmasQuery (String query) {
         query = rewritePositionQuery(query);
         Tree tree = null;
@@ -1382,7 +1405,8 @@
 
         }
         catch (RecognitionException e) {
-            log.error("Could not parse query. Please make sure it is well-formed.");
+            log.error(
+                    "Could not parse query. Please make sure it is well-formed.");
             addError(StatusCodes.MALFORMED_QUERY,
                     "Could not parse query. Please make sure it is well-formed.");
         }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
index b0e88ef..e8dc203 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
@@ -1,5 +1,10 @@
 package de.ids_mannheim.korap.query.serialize;
 
+import de.ids_mannheim.korap.query.object.ClassRefOp;
+import de.ids_mannheim.korap.query.object.KoralFrame;
+import de.ids_mannheim.korap.query.object.KoralMatchOperator;
+import de.ids_mannheim.korap.query.object.KoralOperation;
+import de.ids_mannheim.korap.query.object.KoralTermGroupRelation;
 import de.ids_mannheim.korap.query.parse.poliqarpplus.PoliqarpPlusLexer;
 import de.ids_mannheim.korap.query.parse.poliqarpplus.PoliqarpPlusParser;
 import de.ids_mannheim.korap.query.serialize.util.Antlr4DescriptiveErrorListener;
@@ -29,6 +34,7 @@
  * v0.3.0.
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @author Eliza Margaretha (margaretha@ids-mannheim.de)
  * @version 0.3.0
  * @since 0.1.0
  */
@@ -66,8 +72,8 @@
             processNode(tree);
         }
         else {
-            addError(StatusCodes.MALFORMED_QUERY, "Could not parse query >>> "
-                    + query + " <<<.");
+            addError(StatusCodes.MALFORMED_QUERY,
+                    "Could not parse query >>> " + query + " <<<.");
         }
     }
 
@@ -216,7 +222,7 @@
         ParseTree quantification = getFirstChildWithCat(node, "repetition");
         if (quantification != null) {
             LinkedHashMap<String, Object> quantGroup = KoralObjectGenerator
-                    .makeGroup("repetition");
+                    .makeGroup(KoralOperation.REPETITION);
             Integer[] minmax = parseRepetition(quantification);
             quantGroup.put("boundary",
                     KoralObjectGenerator.makeBoundary(minmax[0], minmax[1]));
@@ -234,9 +240,8 @@
      */
     private void processSequence (ParseTree node) {
         // skip in case of emptyTokenSequence or emptyTokenSequenceClass
-        if (node.getChildCount() == 1
-                && getNodeCat(node.getChild(0))
-                        .startsWith("emptyTokenSequence")) {
+        if (node.getChildCount() == 1 && getNodeCat(node.getChild(0))
+                .startsWith("emptyTokenSequence")) {
             return;
         }
         // skip in case this sequence is just a container for an alignment 
@@ -250,8 +255,8 @@
             }
         }
         LinkedHashMap<String, Object> sequence = KoralObjectGenerator
-                .makeGroup("sequence");
-        
+                .makeGroup(KoralOperation.SEQUENCE);
+
         putIntoSuperObject(sequence);
         objectStack.push(sequence);
         stackedObjects++;
@@ -261,6 +266,7 @@
     @SuppressWarnings("unchecked")
     /**
      * empty tokens at beginning/end of sequence
+     * 
      * @param node
      */
     private void processEmptyTokenSequence (ParseTree node) {
@@ -286,8 +292,8 @@
     private void processEmptyTokenSequenceClass (ParseTree node) {
         int classId = 1;
         if (hasChild(node, "spanclass_id")) {
-            classId = Integer.parseInt(node.getChild(1).getChild(0)
-                    .toStringTree(parser));
+            classId = Integer.parseInt(
+                    node.getChild(1).getChild(0).toStringTree(parser));
         }
         LinkedHashMap<String, Object> classGroup = KoralObjectGenerator
                 .makeSpanClass(classId);
@@ -328,8 +334,9 @@
             }
             term.put("layer", "orth");
             term.put("key", key);
-            String matches = negated ? "ne" : "eq";
-            term.put("match", "match:" + matches);
+            KoralMatchOperator matches = negated ? KoralMatchOperator.NOT_EQUALS
+                    : KoralMatchOperator.EQUALS;
+            term.put("match", matches.toString());
             ParseTree flagNode = getFirstChildWithCat(node, "flag");
             if (flagNode != null) {
                 ArrayList<String> flags = new ArrayList<String>();
@@ -379,7 +386,7 @@
         int i = 1;
         if (node.getChild(0).getText().equals("^")) {
             i = 0; // if there is no first child (anchor is at extreme left or
-                   // right of segment), start counting at 0 in the loop
+                  // right of segment), start counting at 0 in the loop
         }
         // for every alignment anchor, get its left and right child and register
         // these to be wrapped in classes.
@@ -445,9 +452,9 @@
         if (termOpNode != null) {
             String termOp = termOpNode.getText();
             if (termOp.equals("=="))
-                wrappedTerm.put("match", "match:eq");
+                wrappedTerm.put("match", KoralMatchOperator.EQUALS.toString());
             else if (termOp.equals("!="))
-                wrappedTerm.put("match", "match:ne");
+                wrappedTerm.put("match", KoralMatchOperator.NOT_EQUALS.toString());
         }
         if (termNode != null) {
             LinkedHashMap<String, Object> termOrTermGroup = parseTermOrTermGroup(
@@ -467,7 +474,7 @@
 
     private void processDisjunction (ParseTree node) {
         LinkedHashMap<String, Object> disjunction = KoralObjectGenerator
-                .makeGroup("disjunction");
+                .makeGroup(KoralOperation.DISJUNCTION);
         putIntoSuperObject(disjunction);
         objectStack.push(disjunction);
         stackedObjects++;
@@ -484,7 +491,7 @@
 
     private void processRelation (ParseTree node) {
         LinkedHashMap<String, Object> relationGroup = KoralObjectGenerator
-                .makeGroup("relation");
+                .makeGroup(KoralOperation.RELATION);
         LinkedHashMap<String, Object> relation = KoralObjectGenerator
                 .makeRelation();
         LinkedHashMap<String, Object> term = KoralObjectGenerator.makeTerm();
@@ -549,13 +556,13 @@
     private void processMatching (ParseTree node) {
         // Step I: get info
         ArrayList<Integer> classRefs = new ArrayList<Integer>();
-        String classRefOp = null;
+        ClassRefOp classRefOp = null;
         if (getNodeCat(node.getChild(2)).equals("spanclass_id")) {
             ParseTree spanNode = node.getChild(2);
             for (int i = 0; i < spanNode.getChildCount() - 1; i++) {
                 String ref = spanNode.getChild(i).getText();
                 if (ref.equals("|") || ref.equals("&")) {
-                    classRefOp = ref.equals("|") ? "intersection" : "union";
+                    classRefOp = ref.equals("|") ? ClassRefOp.INTERSECTION : ClassRefOp.UNION;
                 }
                 else {
                     try {
@@ -581,7 +588,7 @@
         if (type.equals("split"))
             referenceGroup.put("operation", "operation:split");
         if (classRefOp != null) {
-            referenceGroup.put("classRefOp", "classRefOp:" + classRefOp);
+            referenceGroup.put("classRefOp", classRefOp.toString());
         }
         ArrayList<Object> referenceOperands = new ArrayList<Object>();
         referenceGroup.put("operands", referenceOperands);
@@ -621,8 +628,8 @@
         addWarning("You used the 'meta' keyword in a PoliqarpPlus query. This"
                 + " feature is currently not supported. Please use virtual "
                 + "collections to restrict documents by metadata.");
-        CollectionQueryProcessor cq = new CollectionQueryProcessor(node
-                .getChild(1).getText());
+        CollectionQueryProcessor cq = new CollectionQueryProcessor(
+                node.getChild(1).getText());
         requestMap.put("collection", cq.getRequestMap().get("collection"));
         for (ParseTree child : getChildren(node)) {
             visited.add(child);
@@ -638,8 +645,10 @@
                 .makeSpan(domain);
         LinkedHashMap<String, Object> queryObj = (LinkedHashMap<String, Object>) requestMap
                 .get("query");
+        ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
+        frames.add(KoralFrame.IS_AROUND);
         LinkedHashMap<String, Object> contains = KoralObjectGenerator
-                .makePosition(new String[] { "frames:isAround" });
+                .makePosition(frames);
         ArrayList<Object> operands = (ArrayList<Object>) contains
                 .get("operands");
         operands.add(span);
@@ -712,23 +721,25 @@
 
     private LinkedHashMap<String, Object> parseFrame (ParseTree node) {
         String operator = node.toStringTree(parser).toLowerCase();
-        String[] frames = new String[] { "" };
+        ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
         switch (operator) {
             case "contains":
-                frames = new String[] { "frames:isAround" };
+                frames.add(KoralFrame.IS_AROUND);
                 break;
             case "matches":
-                frames = new String[] { "frames:matches" };
+                frames.add(KoralFrame.MATCHES);
                 break;
             case "startswith":
-                frames = new String[] { "frames:startsWith", "frames:matches" };
+                frames.add(KoralFrame.STARTS_WITH);
+                frames.add(KoralFrame.MATCHES);
                 break;
             case "endswith":
-                frames = new String[] { "frames:endsWith", "frames:matches" };
+                frames.add(KoralFrame.ENDS_WITH);
+                frames.add(KoralFrame.MATCHES);
                 break;
             case "overlaps":
-                frames = new String[] { "frames:overlapsLeft",
-                        "frames:overlapsRight" };
+                frames.add(KoralFrame.OVERLAPS_LEFT);
+                frames.add(KoralFrame.OVERLAPS_RIGHT);
                 break;
         }
         return KoralObjectGenerator.makePosition(frames);
@@ -765,7 +776,8 @@
 
             // Term is defined recursive with non-necessary brackets
             if (getNodeCat(node.getChild(0)).equals("(")) {
-                return parseTermOrTermGroup(node.getChild(1), negatedGlobal, mode);
+                return parseTermOrTermGroup(node.getChild(1), negatedGlobal,
+                        mode);
             };
 
             String key = null;
@@ -856,7 +868,8 @@
 
             // TermGroup is defined recursive with non-necessary brackets
             if (getNodeCat(node.getChild(0)).equals("(")) {
-                return parseTermOrTermGroup(node.getChild(1), negatedGlobal, mode);
+                return parseTermOrTermGroup(node.getChild(1), negatedGlobal,
+                        mode);
             };
 
             // For termGroups, establish a boolean relation between
@@ -877,8 +890,14 @@
                 rightOp = node.getChild(node.getChildCount() - 2);
             // establish boolean relation
             ParseTree boolOp = getFirstChildWithCat(node, "boolOp");
-            String operator = boolOp.getText().equals("&") ? "and" : "or";
-            termGroup = KoralObjectGenerator.makeTermGroup(operator);
+            if (boolOp.getText().equals("&")) {
+                termGroup = KoralObjectGenerator
+                        .makeTermGroup(KoralTermGroupRelation.AND);
+            }
+            else {
+                termGroup = KoralObjectGenerator
+                        .makeTermGroup(KoralTermGroupRelation.OR);
+            }
             ArrayList<Object> operands = (ArrayList<Object>) termGroup
                     .get("operands");
             // recursion with left/right operands
@@ -947,8 +966,8 @@
     private Integer[] parseDistance (ParseTree distanceNode) {
         int emptyTokenSeqIndex = getNodeCat(distanceNode).equals("distance") ? 0
                 : 2;
-        Integer[] minmax = parseEmptySegments(distanceNode
-                .getChild(emptyTokenSeqIndex));
+        Integer[] minmax = parseEmptySegments(
+                distanceNode.getChild(emptyTokenSeqIndex));
         Integer min = minmax[0];
         Integer max = minmax[1];
         //        min++;
@@ -1011,8 +1030,8 @@
 
             // Get starting rule from parser
             Method startRule = PoliqarpPlusParser.class.getMethod("request");
-            tree = (ParserRuleContext) startRule
-                    .invoke(parser, (Object[]) null);
+            tree = (ParserRuleContext) startRule.invoke(parser,
+                    (Object[]) null);
         }
         // Some things went wrong ...
         catch (Exception e) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/util/Converter.java b/src/main/java/de/ids_mannheim/korap/query/serialize/util/Converter.java
new file mode 100644
index 0000000..5691a70
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/util/Converter.java
@@ -0,0 +1,15 @@
+package de.ids_mannheim.korap.query.serialize.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Converter {
+
+    public static List<String> enumListToStringList(List<?> objects){
+        List<String> list = new ArrayList<String>();
+        for (Object o:objects){
+            list.add(o.toString());
+        }
+        return list;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/util/KoralObjectGenerator.java b/src/main/java/de/ids_mannheim/korap/query/serialize/util/KoralObjectGenerator.java
index fc6cc49..8f2b5c6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/util/KoralObjectGenerator.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/util/KoralObjectGenerator.java
@@ -3,7 +3,14 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedHashMap;
+import java.util.List;
 
+import de.ids_mannheim.korap.query.object.ClassRefCheck;
+import de.ids_mannheim.korap.query.object.ClassRefOp;
+import de.ids_mannheim.korap.query.object.KoralFrame;
+import de.ids_mannheim.korap.query.object.KoralOperation;
+import de.ids_mannheim.korap.query.object.KoralTermGroupRelation;
+import de.ids_mannheim.korap.query.object.KoralType;
 import de.ids_mannheim.korap.query.serialize.AbstractQueryProcessor;
 
 public class KoralObjectGenerator {
@@ -19,14 +26,14 @@
 
     public static LinkedHashMap<String, Object> makeSpan () {
         LinkedHashMap<String, Object> span = new LinkedHashMap<String, Object>();
-        span.put("@type", "koral:span");
+        span.put("@type", KoralType.SPAN.toString());
         return span;
     }
 
 
     public static LinkedHashMap<String, Object> makeSpan (String key) {
         LinkedHashMap<String, Object> span = new LinkedHashMap<String, Object>();
-        span.put("@type", "koral:span");
+        span.put("@type", KoralType.SPAN.toString());
         LinkedHashMap<String, Object> term = makeTerm();
         term.put("key", key);
         span.put("wrap", term);
@@ -36,15 +43,15 @@
 
     public static LinkedHashMap<String, Object> makeTerm () {
         LinkedHashMap<String, Object> term = new LinkedHashMap<String, Object>();
-        term.put("@type", "koral:term");
+        term.put("@type", KoralType.TERM.toString());
         return term;
     }
 
 
-    public static LinkedHashMap<String, Object> makeTermGroup (String relation) {
+    public static LinkedHashMap<String, Object> makeTermGroup (KoralTermGroupRelation relation) {
         LinkedHashMap<String, Object> term = new LinkedHashMap<String, Object>();
-        term.put("@type", "koral:termGroup");
-        term.put("relation", "relation:" + relation);
+        term.put("@type", KoralType.TERMGROUP.toString());
+        term.put("relation", relation.toString());
         term.put("operands", new ArrayList<Object>());
         return term;
     }
@@ -52,14 +59,14 @@
 
     public static LinkedHashMap<String, Object> makeDoc () {
         LinkedHashMap<String, Object> term = new LinkedHashMap<String, Object>();
-        term.put("@type", "koral:doc");
+        term.put("@type", KoralType.DOCUMENT.toString());
         return term;
     }
 
 
     public static LinkedHashMap<String, Object> makeDocGroup (String relation) {
         LinkedHashMap<String, Object> term = new LinkedHashMap<String, Object>();
-        term.put("@type", "koral:docGroup");
+        term.put("@type", KoralType.DOCUMENTGROUP.toString());
         term.put("operation", "operation:" + relation);
         term.put("operands", new ArrayList<Object>());
         return term;
@@ -68,15 +75,15 @@
 
     public static LinkedHashMap<String, Object> makeToken () {
         LinkedHashMap<String, Object> token = new LinkedHashMap<String, Object>();
-        token.put("@type", "koral:token");
+        token.put("@type", KoralType.TOKEN.toString());
         return token;
     }
 
 
-    public static LinkedHashMap<String, Object> makeGroup (String operation) {
+    public static LinkedHashMap<String, Object> makeGroup (KoralOperation operation) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:" + operation);
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", operation.toString());
         group.put("operands", new ArrayList<Object>());
         return group;
     }
@@ -84,34 +91,33 @@
 
     public static LinkedHashMap<String, Object> makeRepetition (Integer min,
             Integer max) {
-        LinkedHashMap<String, Object> group = makeGroup("repetition");
+        LinkedHashMap<String, Object> group = makeGroup(KoralOperation.REPETITION);
         group.put("boundary", makeBoundary(min, max));
         return group;
     }
 
 
     @Deprecated
-    public static LinkedHashMap<String, Object> makePosition (String frame) {
+    public static LinkedHashMap<String, Object> makePosition (KoralFrame frame) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:position");
-        group.put("frame", "frame:" + frame);
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", KoralOperation.POSITION.toString());
+        group.put("frame", frame.toString());
         group.put("operands", new ArrayList<Object>());
         return group;
     }
 
 
     public static LinkedHashMap<String, Object> makePosition (
-            String[] allowedFrames) {
+            List<KoralFrame> allowedFrames) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:position");
-        group.put("frames", Arrays.asList(allowedFrames));
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", KoralOperation.POSITION.toString());
+        group.put("frames", Converter.enumListToStringList(allowedFrames));
         group.put("operands", new ArrayList<Object>());
         return group;
     }
 
-
     public static LinkedHashMap<String, Object> makeSpanClass (int classId) {
         return makeSpanClass(classId, false);
     }
@@ -121,8 +127,8 @@
     public static LinkedHashMap<String, Object> makeSpanClass (int classId,
             boolean setBySystem) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:class");
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", KoralOperation.CLASS.toString());
         if (setBySystem) {
             classId += 128;
             qp.addMessage("A class has been introduced into the backend representation of "
@@ -136,11 +142,11 @@
 
 
     public static LinkedHashMap<String, Object> makeClassRefCheck (
-            ArrayList<String> check, Integer[] classIn, int classOut) {
+            ArrayList<ClassRefCheck> checks, Integer[] classIn, int classOut) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:class");
-        group.put("classRefCheck", check);
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", KoralOperation.CLASS.toString());
+        group.put("classRefCheck", Converter.enumListToStringList(checks));
         group.put("classIn", Arrays.asList(classIn));
         group.put("classOut", classOut);
         group.put("operands", new ArrayList<Object>());
@@ -149,11 +155,11 @@
 
 
     public static LinkedHashMap<String, Object> makeClassRefOp (
-            String operation, Integer[] classIn, int classOut) {
+            ClassRefOp operation, Integer[] classIn, int classOut) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:group");
-        group.put("operation", "operation:class");
-        group.put("classRefOp", operation);
+        group.put("@type", KoralType.GROUP.toString());
+        group.put("operation", KoralOperation.CLASS.toString());
+        group.put("classRefOp", operation.toString());
         group.put("classIn", Arrays.asList(classIn));
         group.put("classOut", classOut);
         group.put("operands", new ArrayList<Object>());
@@ -161,19 +167,19 @@
     }
 
 
-    @Deprecated
-    public static LinkedHashMap<String, Object> makeTreeRelation (String reltype) {
-        LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:treeRelation");
-        if (reltype != null)
-            group.put("reltype", reltype);
-        return group;
-    }
+//    @Deprecated
+//    public static LinkedHashMap<String, Object> makeTreeRelation (String reltype) {
+//        LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
+//        group.put("@type", "koral:treeRelation");
+//        if (reltype != null)
+//            group.put("reltype", reltype);
+//        return group;
+//    }
 
 
     public static LinkedHashMap<String, Object> makeRelation () {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:relation");
+        group.put("@type", KoralType.RELATION.toString());
         return group;
     }
 
@@ -181,7 +187,7 @@
     public static LinkedHashMap<String, Object> makeBoundary (Integer min,
             Integer max) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:boundary");
+        group.put("@type", KoralType.BOUNDARY.toString());
         group.put("min", min);
         if (max != null) {
             group.put("max", max);
@@ -194,10 +200,10 @@
             Integer min, Integer max) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
         if (key.equals("w")) {
-            group.put("@type", "koral:distance");
+            group.put("@type", KoralType.DISTANCE.toString());
         }
         else {
-            group.put("@type", "cosmas:distance");
+            group.put("@type", KoralType.COSMAS_DISTANCE.toString());
         }
         group.put("key", key);
         group.put("boundary", makeBoundary(min, max));
@@ -213,10 +219,10 @@
 
 
     public static LinkedHashMap<String, Object> makeReference (
-            ArrayList<Integer> classRefs, String operation) {
+            ArrayList<Integer> classRefs, KoralOperation operation) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:reference");
-        group.put("operation", "operation:" + operation);
+        group.put("@type", KoralType.REFERENCE.toString());
+        group.put("operation", operation.toString());
         if (classRefs != null && !classRefs.isEmpty()) {
             group.put("classRef", classRefs);
         }
@@ -226,13 +232,13 @@
 
     public static LinkedHashMap<String, Object> makeReference (
             ArrayList<Integer> classRefs) {
-        return makeReference(classRefs, "focus");
+        return makeReference(classRefs, KoralOperation.FOCUS);
     }
 
 
     @Deprecated
     public static LinkedHashMap<String, Object> makeReference (int classRef,
-            String operation, boolean setBySystem) {
+            KoralOperation operation, boolean setBySystem) {
         ArrayList<Integer> classRefs = new ArrayList<Integer>();
         if (setBySystem)
             classRef = classRef + 128;
@@ -248,7 +254,7 @@
         if (setBySystem)
             classRef = classRef + 128;
         classRefs.add(classRef);
-        return makeReference(classRefs, "focus");
+        return makeReference(classRefs, KoralOperation.FOCUS);
     }
 
 
@@ -260,8 +266,8 @@
     @Deprecated
     public static LinkedHashMap<String, Object> makeResetReference () {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:reference");
-        group.put("operation", "operation:focus");
+        group.put("@type", KoralType.REFERENCE.toString());
+        group.put("operation", KoralOperation.FOCUS.toString());
         group.put("reset", true);
         group.put("operands", new ArrayList<Object>());
         return group;
@@ -269,10 +275,10 @@
 
 
     public static LinkedHashMap<String, Object> makeSpanReference (
-            Integer[] spanRef, String operation) {
+            Integer[] spanRef, KoralOperation operation) {
         LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
-        group.put("@type", "koral:reference");
-        group.put("operation", "operation:" + operation);
+        group.put("@type", KoralType.REFERENCE.toString());
+        group.put("operation", operation.toString());
         group.put("spanRef", Arrays.asList(spanRef));
         group.put("operands", new ArrayList<Object>());
         return group;
