diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
index 501c190..0240a15 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
@@ -10,31 +10,46 @@
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.slf4j.Logger;
 
+/**
+ * This is an abstract class which provides fields and methods for concrete
+ * query processor implementations. All of those must implement 
+ * {@link #process(String)}, which is expected to process the query
+ * and store a {@link #java.util.Map} representation of the KoralQuery
+ * JSON-LD tree for that query. 
+ * 
+ * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @version 0.1.0
+ * @since 0.1.0
+ */
 public abstract class AbstractQueryProcessor {
 
     Logger log;
     /**
-     *  The query
+     *  The query string.
      */
     String query;
     /**
      * Top-level map representing the whole request.
      */
-    LinkedHashMap<String, Object> requestMap = new LinkedHashMap<String, Object>();
+    LinkedHashMap<String, Object> requestMap = 
+            new LinkedHashMap<String, Object>();
     /**
-     * Keeps track of open node categories
+     * Keeps track of open node categories.
      */
     LinkedList<String> openNodeCats = new LinkedList<String>();
     /**
-     * Keeps track of all visited nodes in a tree
+     * Keeps track of all visited nodes in a tree.
      */
     List<ParseTree> visited = new ArrayList<ParseTree>();
     /**
-     * Keeps track of active object.
+     * Keeps track of active object, used for inserting new KoralQuery objects
+     * into last created objects.
      */
-    LinkedList<LinkedHashMap<String, Object>> objectStack = new LinkedList<LinkedHashMap<String, Object>>();
+    LinkedList<LinkedHashMap<String, Object>> objectStack = 
+            new LinkedList<LinkedHashMap<String, Object>>();
     /**
-     * Keeps track of how many objects there are to pop after every recursion of {@link #processNode(ParseTree)}
+     * Keeps track of how many objects there are to pop after every recursion
+     * of {@link #processNode(ParseTree)}
      */
     LinkedList<Integer> objectsToPop = new LinkedList<Integer>();
     /**
@@ -42,15 +57,37 @@
      */
     public static boolean verbose = false;
     protected Integer stackedObjects = 0;
+    /**
+     * Contains error arrays, consisting of an error code and a message.
+     */
     private ArrayList<List<Object>> errors = new ArrayList<List<Object>>();
+    /**
+     * Contains warning arrays, consisting of a warning code (optional) and a
+     * message.
+     */
     private ArrayList<List<Object>> warnings = new ArrayList<List<Object>>();
+    /**
+     * Contains other messages.
+     */
     private ArrayList<List<Object>> messages = new ArrayList<List<Object>>();
-    private LinkedHashMap<String, Object> collection = new LinkedHashMap<String,Object>();
-    private LinkedHashMap<String, Object> meta = new LinkedHashMap<String,Object>();
+    /**
+     * Virtual collection queries.
+     */
+    private LinkedHashMap<String, Object> collection = 
+            new LinkedHashMap<String,Object>();
+    /**
+     * Holds information on displaying directives.
+     */
+    private LinkedHashMap<String, Object> meta = 
+            new LinkedHashMap<String,Object>();
+    /**
+     * Indicates which classes are to be highlighted in KWIC view.
+     */
     private ArrayList<Integer> highlightClasses = new ArrayList<Integer>();
 
     AbstractQueryProcessor() {
-        requestMap.put("@context", "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld");
+        requestMap.put("@context", "http://ids-mannheim.de/ns/KorAP/json-ld/"
+                + "v0.2/context.jsonld");
         requestMap.put("errors", errors);
         requestMap.put("warnings", warnings);
         requestMap.put("messages", messages);
@@ -59,42 +96,85 @@
         requestMap.put("meta", meta);
     }
 
+    /**
+     * Called to process the query, is expected to generate a Map-based 
+     * KoralQuery representation in {@link #requestMap}. 
+     * @param query The query string.
+     */
     public abstract void process(String query);
 
+    /**
+     * Adds a warning to {@link #warnings}.
+     * @param code The warning code.
+     * @param msg The warning message.
+     */
     public void addWarning(int code, String msg) {
         List<Object> warning = Arrays.asList(new Object[]{code, msg}); 
         warnings.add(warning);
     }
 
+    /**
+     * Adds a warning to {@link #warnings}.
+     * @param msg The warning message.
+     */
     public void addWarning(String msg) {
         List<Object> warning = Arrays.asList(new Object[]{msg}); 
         warnings.add(warning);
     }
 
+    /**
+     * Adds a generic message to {@link #messages}.
+     * @param code The message code.
+     * @param msg The message string.
+     */
     public void addMessage(int code, String msg) {
         List<Object> message = Arrays.asList(new Object[]{code, msg}); 
         messages.add(message);
     }
 
+    /**
+     * Adds a generic message to {@link #messages}.
+     * @param msg The message string.
+     */
     public void addMessage(String msg) {
         List<Object> message = Arrays.asList(new Object[]{msg}); 
         messages.add(message);
     }
 
+    /**
+     * Adds an error to {@link #errors}.
+     * @param code The error code.
+     * @param msg The error message.
+     */
     public void addError(int code, String msg) {
         List<Object> error = Arrays.asList(new Object[]{code, msg}); 
         errors.add(error);
     }
 
+    /**
+     * Adds an error to {@link #errors}.
+     * @param fullErrorMsg First object is expected to be an integer
+     * error code, second a message.
+     */
     public void addError(List<Object> fullErrorMsg) {
         errors.add(fullErrorMsg);
     }
 
+    /**
+     * Add a class to the list of classes highlighted in KWIC view.
+     * @param classId The class ID.
+     */
     public void addHighlightClass(int classId) {
         highlightClasses.add(classId);
         meta.put("highlight", highlightClasses);
     }
 
+    /**
+     * Getter method for the {@link #requestMap}, which represents the
+     * entire KoralQuery request (query, displaying directives, virtual 
+     * collections, messages etc.) based on a Java Map.
+     * @return
+     */
     public Map<String, Object> getRequestMap() {
         return requestMap;
     }
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 6f95189..298d45d 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
@@ -27,26 +27,39 @@
 import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
 
 /**
- * Map representation of ANNIS QL syntax tree as returned by ANTLR
+ * Processor class for ANNIS QL queries. This class uses an ANTLR v4 grammar
+ * for query parsing, it therefore extends {@link Antlr4AbstractQueryProcessor}.
+ * The parser object is inherited from the parent class and instantiated in
+ * {@link #parseAnnisQuery(String)} as an {@link AqlParser}.
+ * 
+ * @see http://annis-tools.org/aql.html
+ * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- *
+ * @version 0.1.0
+ * @since 0.1.0
  */
 public class AnnisQueryProcessor extends Antlr4AbstractQueryProcessor {
     private static Logger log = LoggerFactory.getLogger(AnnisQueryProcessor.class);
     /**
-     * Flag that indicates whether token fields or meta fields are currently being processed
+     * Flag that indicates whether token fields or meta fields are currently 
+     * being processed
      */
     boolean inMeta = false;
     /**
-     * Keeps track of operands that are to be integrated into yet uncreated objects.
+     * Keeps track of operands that are to be integrated into yet uncreated 
+     * objects.
      */
-    LinkedList<LinkedHashMap<String,Object>> operandStack = new LinkedList<LinkedHashMap<String,Object>>();
+    LinkedList<LinkedHashMap<String,Object>> operandStack = 
+            new LinkedList<LinkedHashMap<String,Object>>();
     /**
-     * Keeps track of explicitly (by #-var definition) or implicitly (number as reference) introduced entities (for later reference by #-operator)
+     * Keeps track of explicitly (by #-var definition) or implicitly (number 
+     * as reference) introduced entities (for later reference by #-operator)
      */
-    Map<String, LinkedHashMap<String,Object>> nodeVariables = new LinkedHashMap<String, LinkedHashMap<String,Object>>();
+    Map<String, LinkedHashMap<String,Object>> nodeVariables = 
+            new LinkedHashMap<String, LinkedHashMap<String,Object>>();
     /**
-     * Keeps track of explicitly (by #-var definition) or implicitly (number as reference) introduced entities (for later reference by #-operator)
+     * Keeps track of explicitly (by #-var definition) or implicitly (number 
+     * as reference) introduced entities (for later reference by #-operator)
      */
     Map<ParseTree, String> nodes2refs= new LinkedHashMap<ParseTree, String>(); 
     /**
@@ -54,58 +67,76 @@
      */
     Integer variableCount = 1;
     /**
-     * Marks the currently active token in order to know where to add flags (might already have been taken away from token stack).
+     * Marks the currently active token in order to know where to add flags 
+     * (might already have been taken away from token stack).
      */
     LinkedHashMap<String,Object> curToken = new LinkedHashMap<String,Object>();
     /**
      * Keeps track of operands lists that are to be serialised in an inverted
      * order (e.g. the IN() operator) compared to their AST representation. 
      */
-    private LinkedList<ArrayList<Object>> invertedOperandsLists = new LinkedList<ArrayList<Object>>();
+    private LinkedList<ArrayList<Object>> invertedOperandsLists = 
+            new LinkedList<ArrayList<Object>>();
     /**
      * Keeps track of operation:class numbers.
      */
     int classCounter = 1;
     /**
-     * Keeps track of numers of relations processed (important when dealing with multiple predications).
+     * Keeps track of numers of relations processed (important when dealing 
+     * with multiple predications).
      */
     int relationCounter = 0;
     /**
-     * Keeps track of references to nodes that are operands of groups (e.g. tree relations). Those nodes appear on the top level of the parse tree
-     * but are to be integrated into the AqlTree at a later point (namely as operands of the respective group). Therefore, store references to these
-     * nodes here and exclude the operands from being written into the query map individually.   
+     * Keeps track of references to nodes that are operands of groups (e.g. 
+     * tree relations). Those nodes appear on the top level of the parse tree
+     * but are to be integrated into the AqlTree at a later point (namely as 
+     * operands of the respective group). Therefore, store references to these
+     * nodes here and exclude the operands from being written into the query 
+     * map individually.   
      */
     private int totalRelationCount = 0;
     /**
-     * Keeps a record of reference-class-mapping, i.e. which 'class' has been assigned to which #n reference. This is important when introducing korap:reference 
-     * spans to refer back to previously established classes for entities.
+     * Keeps a record of reference-class-mapping, i.e. which 'class' has been 
+     * assigned to which #n reference. This is important when introducing 
+     * korap:reference spans to refer back to previously established classes for 
+     * entities.
      */
-    private LinkedHashMap<String, Integer> refClassMapping = new LinkedHashMap<String, Integer>();
+    private LinkedHashMap<String, Integer> refClassMapping = 
+            new LinkedHashMap<String, Integer>();
     /**
      * Keeps a record of unary relations on spans/tokens.
      */
-    private LinkedHashMap<String, ArrayList<ParseTree>> unaryRelations = new LinkedHashMap<String, ArrayList<ParseTree>>();
+    private LinkedHashMap<String, ArrayList<ParseTree>> unaryRelations = 
+            new LinkedHashMap<String, ArrayList<ParseTree>>();
     /**
-     * Keeps track of the number of references to a node/token by means of #n. E.g. in the query 
-     * <tt>tok="x" & tok="y" & tok="z" & #1 . #2 & #2 . #3</tt>, the 2nd token ("y") is referenced twice, the others once.
+     * Keeps track of the number of references to a node/token by means of #n. 
+     * E.g. in the query <tt>tok="x" & tok="y" & tok="z" & #1 . #2 & #2 . #3</tt>, 
+     * the 2nd token ("y") is referenced twice, the others once.
      */
-    private LinkedHashMap<String, Integer> nodeReferencesTotal = new LinkedHashMap<String, Integer>();
+    private LinkedHashMap<String, Integer> nodeReferencesTotal = 
+            new LinkedHashMap<String, Integer>();
     /**
-     * Keeps track of the number of references to a node/token that have already been processed.
+     * Keeps track of the number of references to a node/token that have 
+     * already been processed.
      */
-    private LinkedHashMap<String, Integer> nodeReferencesProcessed = new LinkedHashMap<String, Integer>();
+    private LinkedHashMap<String, Integer> nodeReferencesProcessed = 
+            new LinkedHashMap<String, Integer>();
     /**
-     * Keeps track of queued relations. Relations sometimes cannot be processed directly, namely in case it does not share 
-     * any operands with the previous relation. Then wait until a relation with a shared operand has been processed.
+     * Keeps track of queued relations. Relations sometimes cannot be processed
+     * directly, namely in case it does not share any operands with the 
+     * previous relation. Then wait until a relation with a shared operand has 
+     * been processed.
      */
     private LinkedList<ParseTree> queuedRelations = new LinkedList<ParseTree>();
     /**
-     * For some objects, it may be decided in the initial scan (processAndTopExpr()) that they
-     * need to be wrapped in a class operation when retrieved later. This map stores this information.
-     * More precisely, it stores for every node in the tree which class ID its derived Koral
-     * object will receive.
+     * For some objects, it may be decided in the initial scan 
+     * ({@link #processAndTopExpr(ParseTree)} that they need to be wrapped in a
+     * class operation when retrieved later. This map stores this information.
+     * More precisely, it stores for every node in the tree which class ID its 
+     * derived KoralQuery object will receive.
      */
-    private LinkedHashMap<ParseTree, Integer> objectsToWrapInClass = new LinkedHashMap<ParseTree, Integer>();
+    private LinkedHashMap<ParseTree, Integer> objectsToWrapInClass = 
+            new LinkedHashMap<ParseTree, Integer>();
 
     public AnnisQueryProcessor(String query) {
         KoralObjectGenerator.setQueryProcessor(this);
@@ -127,26 +158,35 @@
             // Last check to see if all relations have left the queue
             if (!queuedRelations.isEmpty()) {
                 ParseTree queued = queuedRelations.pop();
-                if (verbose) System.out.println("Taking off queue (last rel): "+ queued.getText());
+                if (verbose) System.out.println("Taking off queue (last rel): "
+                        + queued.getText());
                 if (checkOperandsProcessedPreviously(queued)) {
                     processNode(queued);
                 } else {
-                    addError(StatusCodes.UNBOUND_ANNIS_RELATION, "The relation "+queued.getText()
-                            +" is not bound to any other relations.");
-                    requestMap.put("query", new LinkedHashMap<String, Object>());
+                    addError(StatusCodes.UNBOUND_ANNIS_RELATION, 
+                            "The relation " +queued.getText()+ 
+                            " is not bound to any other relations.");
+                    requestMap.put("query", 
+                            new LinkedHashMap<String, Object>());
                 }
             }
         }
     }
 
+    /**
+     * Traverses the parse tree by recursively calling itself, starting with
+     * the root node of the tree and calling itself with the children of its
+     * current node in a depth-first, left-to-right fashion. In each call,
+     * depending on the category of the current node, special processor
+     * methods for the respective node category are called to process the node.
+     * @param node The node currently visited in the parse tree traversal.
+     */
     private void processNode(ParseTree node) {
         String nodeCat = getNodeCat(node);
-
         // Top-down processing
         if (visited.contains(node)) return;
         openNodeCats.push(nodeCat);
         stackedObjects = 0;
-
         // Before doing anything else, check if any relations are queued
         // and need to be processed first
         if (nodeCat.equals("n_ary_linguistic_term")) {
@@ -160,7 +200,6 @@
                 }
             }  
         }
-
         if (verbose) {
             System.err.println(" "+objectStack);
             System.out.println(openNodeCats);
@@ -181,17 +220,9 @@
             processAndTopExpr(node);
         }
 
-//        if (nodeCat.equals("unary_linguistic_term")) {
-//            processUnary_linguistic_term(node);
-//        }
-
         if (nodeCat.equals("n_ary_linguistic_term")) {
             processN_ary_linguistic_term(node);
         }
-//
-//        if (nodeCat.equals("variableExpr")) {
-//            processVariableExpr(node);
-//        }
 
         objectsToPop.push(stackedObjects);
 
@@ -220,29 +251,42 @@
         openNodeCats.pop();
     }
 
-
-
+    /**
+     * Processes an <tt>andTopExpr</tt> node. This is a child of the root
+     * and contains a set of expressions connected by logical conjunction.
+     * Several of these nodes are possibly connected via disjunction.
+     * @param node The current parse tree node (must be of category 
+     * <tt>andTopExpr</tt>). 
+     */
     private void processAndTopExpr(ParseTree node) {
-        // Before processing any child expr node, check if it has one or more "*ary_linguistic_term" nodes.
+        // Before processing any child expr node, check if it has one or more 
+        // "*ary_linguistic_term" nodes.
         // Those nodes may use references to earlier established operand nodes.
-        // Those operand nodes are not to be included into the query map individually but
-        // naturally as operands of the relations/groups introduced by the 
-        // *node. For that purpose, this section mines all used references
-        // and stores them in a list for later reference.
-        for (ParseTree unaryTermNode : getDescendantsWithCat(node, "unary_linguistic_term")) {
+        // Those operand nodes are not to be included into the query map 
+        // individually but naturally as operands of the relations/groups 
+        // introduced by the node. For that purpose, this section mines all 
+        // used references and stores them in a list for later reference.
+        for (ParseTree unaryTermNode : 
+                getDescendantsWithCat(node, "unary_linguistic_term")) {
             String ref = getNodeCat(unaryTermNode.getChild(0)).substring(1);
             ArrayList<ParseTree> unaryTermsForRef = unaryRelations.get(ref);
-            if (unaryTermsForRef == null) unaryTermsForRef = new ArrayList<ParseTree>();
+            if (unaryTermsForRef == null) unaryTermsForRef = 
+                    new ArrayList<ParseTree>();
             unaryTermsForRef.add(unaryTermNode);
             unaryRelations.put(ref, unaryTermsForRef);
         }
-        for (ParseTree lingTermNode : getDescendantsWithCat(node, "n_ary_linguistic_term")) {
-            for (ParseTree refOrNode : getChildrenWithCat(lingTermNode, "refOrNode")) {
-                String refOrNodeString = refOrNode.getChild(0).toStringTree(parser);
+        for (ParseTree lingTermNode : 
+                getDescendantsWithCat(node, "n_ary_linguistic_term")) {
+            for (ParseTree refOrNode : 
+                    getChildrenWithCat(lingTermNode, "refOrNode")) {
+                String refOrNodeString = 
+                        refOrNode.getChild(0).toStringTree(parser);
                 if (refOrNodeString.startsWith("#")) {
-                    String ref = refOrNode.getChild(0).toStringTree(parser).substring(1);
+                    String ref = refOrNode.getChild(0).toStringTree(parser).
+                            substring(1);
                     if (nodeReferencesTotal.containsKey(ref)) {
-                        nodeReferencesTotal.put(ref, nodeReferencesTotal.get(ref)+1);
+                        nodeReferencesTotal.put(ref, 
+                                nodeReferencesTotal.get(ref)+1);
                     } else {
                         nodeReferencesTotal.put(ref, 1);
                         nodeReferencesProcessed.put(ref, 0);   
@@ -252,54 +296,54 @@
             totalRelationCount++;
         }
         // Then, mine all object definitions. 
-        for (ParseTree variableExprNode : getDescendantsWithCat(node, "variableExpr")) {
+        for (ParseTree variableExprNode : 
+                getDescendantsWithCat(node, "variableExpr")) {
             String ref;
             // might be a ref label rather than a counting number
-            ParseTree varDef = getFirstChildWithCat(variableExprNode.getParent(), "varDef");
+            ParseTree varDef = 
+                    getFirstChildWithCat(variableExprNode.getParent(),"varDef");
             if (varDef != null) {
-                ref = varDef.getText().replaceFirst("#", ""); // remove trailing #
+                // remove trailing #
+                ref = varDef.getText().replaceFirst("#", ""); 
             } else {
                 ref = variableCount.toString();
             }
             nodes2refs.put(variableExprNode, ref);
-            LinkedHashMap<String,Object> object = processVariableExpr(variableExprNode);
+            LinkedHashMap<String,Object> object = 
+                    processVariableExpr(variableExprNode);
             nodeVariables.put(ref, object);            
             variableCount++;
-            // Check if this object definition is part of a "direct declaration relation", 
-            // i.e. a relation which declares its operands directly rather than using
-            // references to earlier declared objects. These objects must still be
-            // available for later reference, handle this here. 
-            // Direct declaration relation is present when grandparent is n_ary_linguistic_term node.
-            if (getNodeCat(variableExprNode.getParent().getParent()).equals("n_ary_linguistic_term")) {
+            // Check if this object definition is part of a "direct declaration
+            // relation", i.e. a relation which declares its operands directly
+            // rather than using references to earlier declared objects. These 
+            // objects must still be available for later reference, handle this 
+            // here. Direct declaration relation is present when grandparent is
+            // n_ary_linguistic_term node.
+            if (getNodeCat(variableExprNode.getParent().getParent()).
+                    equals("n_ary_linguistic_term")) {
                 if (nodeReferencesTotal.containsKey(ref)) {
-                    nodeReferencesTotal.put(ref, nodeReferencesTotal.get(ref)+1);
+                    nodeReferencesTotal.put(ref,nodeReferencesTotal.get(ref)+1);
                 } else {
                     nodeReferencesTotal.put(ref, 1);
                 }
-                // This is important for later relations wrapping the present relation.
-                // If the object isn't registered as processed, it won't be available
-                // for referencing.
+                // This is important for later relations wrapping the present 
+                // relation. If the object isn't registered as processed, it 
+                // won't be available  for referencing.
                 nodeReferencesProcessed.put(ref, 1);  
                 // Register this node for latter wrapping in class.
                 if (nodeReferencesTotal.get(ref) > 1) {
-                    refClassMapping.put(ref, classCounter);
-                    objectsToWrapInClass.put(variableExprNode, classCounter++);    
+                    refClassMapping.put(ref, classCounter+128);
+                    objectsToWrapInClass.put(variableExprNode, 128+classCounter++);    
                 }
             }
         }
     }
-//
-//    private void processUnary_linguistic_term(ParseTree node) {
-//        LinkedHashMap<String, Object> unaryOperator = parseUnaryOperator(node);
-//        String reference = node.getChild(0).toStringTree(parser).substring(1);
-//        LinkedHashMap<String, Object> object = nodeVariables.get(reference);
-//        object.putAll(unaryOperator);
-//    }
 
     private void processExprTop(ParseTree node) {
         List<ParseTree> andTopExprs = getChildrenWithCat(node, "andTopExpr");
         if (andTopExprs.size() > 1) {
-            LinkedHashMap<String, Object> topOr = KoralObjectGenerator.makeGroup("disjunction");
+            LinkedHashMap<String, Object> topOr = 
+                    KoralObjectGenerator.makeGroup("disjunction");
             requestMap.put("query", topOr);
             objectStack.push(topOr);
         }
@@ -315,17 +359,24 @@
         } else if (firstChildNodeCat.equals("tok")) {
             object = KoralObjectGenerator.makeToken();
             if (node.getChildCount() > 1) { // empty tokens do not wrap a term
-                LinkedHashMap<String, Object> term = KoralObjectGenerator.makeTerm();
+                LinkedHashMap<String, Object> term = 
+                        KoralObjectGenerator.makeTerm();
                 term.put("layer", "orth");
                 object.put("wrap", term);
             }
-        } else if (firstChildNodeCat.equals("qName")) {	// only (foundry/)?layer specified
-            // may be token or span, depending on indicated layer! (e.g. cnx/cat=NP vs mate/pos=NN)
-            // TODO generalize the list below -> look up layers associated with tokens rather than spans somewhere
-            HashMap<String, Object> qNameParse = parseQNameNode(node.getChild(0));
-            if (Arrays.asList(new String[]{"p", "lemma", "m", "orth"}).contains(qNameParse.get("layer"))) { 
+        } else if (firstChildNodeCat.equals("qName")) {	
+            // Only (foundry/)?layer specified.
+            // May be token or span, depending on indicated layer! 
+            // (e.g. cnx/cat=NP vs mate/pos=NN)
+            // TODO generalize the list below -> look up layers associated with
+            // tokens rather than spans somewhere
+            HashMap<String, Object> qNameParse = 
+                    parseQNameNode(node.getChild(0));
+            if (Arrays.asList(new String[]{"p", "lemma", "m", "orth"}).
+                    contains(qNameParse.get("layer"))) { 
                 object = KoralObjectGenerator.makeToken();
-                LinkedHashMap<String, Object> term = KoralObjectGenerator.makeTerm();
+                LinkedHashMap<String, Object> term = 
+                        KoralObjectGenerator.makeTerm();
                 object.put("wrap", term);
                 term.putAll(qNameParse);
             } else {
@@ -334,20 +385,24 @@
             }
         } else if (firstChildNodeCat.equals("textSpec")) {
             object = KoralObjectGenerator.makeToken();
-            LinkedHashMap<String, Object> term = KoralObjectGenerator.makeTerm();
+            LinkedHashMap<String, Object> term = 
+                    KoralObjectGenerator.makeTerm();
             object.put("wrap", term);
             term.put("layer", "orth");
             term.putAll(parseTextSpec(node.getChild(0)));
         }
-
-        if (node.getChildCount() == 3) {  			// (foundry/)?layer=key specification
+        if (node.getChildCount() == 3) {  			
+            // (foundry/)?layer=key specification
             if (object.get("@type").equals("korap:token")) {
-                HashMap<String, Object> term = (HashMap<String, Object>) object.get("wrap");
+                HashMap<String, Object> term = (HashMap<String, Object>) 
+                        object.get("wrap");
                 term.putAll(parseTextSpec(node.getChild(2)));
-                term.put("match", parseMatchOperator(getFirstChildWithCat(node, "eqOperator")));
+                term.put("match", parseMatchOperator(
+                        getFirstChildWithCat(node, "eqOperator")));
             } else {
                 object.putAll(parseTextSpec(node.getChild(2)));
-                object.put("match", parseMatchOperator(getFirstChildWithCat(node, "eqOperator")));
+                object.put("match", parseMatchOperator(
+                        getFirstChildWithCat(node, "eqOperator")));
             }
         }
 
@@ -360,8 +415,10 @@
                 object.put("attr", 
                         parseUnaryOperator(unaryTermsForRef.get(0)));   
             } else {
-                LinkedHashMap<String, Object> termGroup = KoralObjectGenerator.makeTermGroup("and");
-                ArrayList<Object> operands = (ArrayList<Object>) termGroup.get("operands");
+                LinkedHashMap<String, Object> termGroup = 
+                        KoralObjectGenerator.makeTermGroup("and");
+                ArrayList<Object> operands = (ArrayList<Object>) 
+                        termGroup.get("operands");
                 for (ParseTree unaryTerm : unaryTermsForRef) {
                     operands.add(parseUnaryOperator(unaryTerm));
                 }
@@ -375,7 +432,8 @@
             }
             ParseTree parentsFirstChild = node.getParent().getChild(0);
             if (getNodeCat(parentsFirstChild).endsWith("#")) {
-                nodeVariables.put(getNodeCat(parentsFirstChild).replaceAll("#", ""), object);
+                nodeVariables.put(getNodeCat(parentsFirstChild).
+                        replaceAll("#", ""), object);
             }
             if (objectsToWrapInClass.containsKey(node)) {
                 int classId = objectsToWrapInClass.get(node);
@@ -386,30 +444,38 @@
     }
 
     /**
-     * Processes an operand node, creating a map for the operand containing all its information
-     * given in the node definition (referenced via '#'). If this node has been referred to and used earlier,
-     * a reference is created in its place. 
-     * The operand will be wrapped in a class group if necessary.
-     * @param operandNode
-     * @return A map object with the appropriate Koral representation of the operand 
+     * Processes an operand node, creating a map for the operand containing 
+     * all its information given in the node definition (referenced via '#'). 
+     * If this node has been referred to and used earlier, a reference is 
+     * created in its place. The operand will be wrapped in a class group if 
+     * necessary.
+     * @param operandNode The operand node of a relation, e.g. '#1'
+     * @return A map object with the appropriate KoralQuery representation
+     * of the operand 
      */
     private LinkedHashMap<String, Object> retrieveOperand(ParseTree operandNode) {
         LinkedHashMap<String, Object> operand = null;
         if (!getNodeCat(operandNode.getChild(0)).equals("variableExpr")) {
-            String ref = operandNode.getChild(0).toStringTree(parser).substring(1);
+            String ref = 
+                    operandNode.getChild(0).toStringTree(parser).substring(1);
             operand = nodeVariables.get(ref);
             if (nodeReferencesTotal.get(ref) > 1) {
                 if (nodeReferencesProcessed.get(ref)==0) {
-                    refClassMapping.put(ref, classCounter);
-                    operand = KoralObjectGenerator.wrapInClass(operand, classCounter++);
-                } else if (nodeReferencesProcessed.get(ref)>0 && nodeReferencesTotal.get(ref)>1) {
+                    refClassMapping.put(ref, classCounter+128);
+                    operand = KoralObjectGenerator.
+                            wrapInClass(operand, 128+classCounter++);
+                } else if (nodeReferencesProcessed.get(ref)>0 && 
+                        nodeReferencesTotal.get(ref)>1) {
                     try {
-                        operand = KoralObjectGenerator.wrapInReference(operandStack.pop(), refClassMapping.get(ref), true);
+                        operand = KoralObjectGenerator.wrapInReference(
+                                operandStack.pop(), refClassMapping.get(ref));
                     } catch (NoSuchElementException e) {
-                        operand = KoralObjectGenerator.makeReference(refClassMapping.get(ref));
+                        operand = KoralObjectGenerator.makeReference(
+                                refClassMapping.get(ref));
                     }
                 }
-                nodeReferencesProcessed.put(ref, nodeReferencesProcessed.get(ref)+1);
+                nodeReferencesProcessed.put(ref, 
+                        nodeReferencesProcessed.get(ref)+1);
             }
         } else {
             operand = processVariableExpr(operandNode.getChild(0));
@@ -425,7 +491,8 @@
         // We can assume two operands.
         ParseTree operand1 = node.getChild(0);
         ParseTree operand2 = node.getChild(2);
-        if (checkOperandProcessedPreviously(operand1) || checkOperandProcessedPreviously(operand2)) {
+        if (checkOperandProcessedPreviously(operand1) || 
+                checkOperandProcessedPreviously(operand2)) {
             return true;
         }
         return false;
@@ -449,9 +516,11 @@
     @SuppressWarnings("unchecked")
     private void processN_ary_linguistic_term(ParseTree node) {
         relationCounter++;
-        // get operator and determine type of group (sequence/treeRelation/relation/...)
-        // It's possible in Annis QL to concatenate operators, so there may be several operators under one n_ary_linguistic_term node. 
-        // Counter 'i' will iteratively point to all operator nodes (odd-numbered) under this node.
+        // Get operator and determine type of group (sequence/treeRelation/
+        // relation/...). It's possible in Annis QL to concatenate operatiors,
+        // so there may be several operators under one n_ary_linguistic_term 
+        // node. Counter 'i' will iteratively point to all operator nodes 
+        // (odd-numbered children) under this node.
         for (int i=1; i<node.getChildCount(); i = i+2) {
             ParseTree operandTree1 = node.getChild(i-1);
             ParseTree operandTree2 = node.getChild(i+1);
@@ -476,61 +545,86 @@
                 }
             }
             // Retrieve operands.
-            LinkedHashMap<String, Object> operand1 = retrieveOperand(operandTree1);
-            LinkedHashMap<String, Object> operand2 = retrieveOperand(operandTree2);
-            // 'Proper' n_ary_linguistic_operators receive a considerably different serialisation than 'commonparent' and 'commonancestor'.
-            // For the latter cases, a dummy span is introduced and declared as a span class that has a dominance relation towards
-            // the two operands, one after the other, thus resulting in two nested relations! A Poliqarp+ equivalent for A $ B would be
+            LinkedHashMap<String, Object> operand1 = 
+                    retrieveOperand(operandTree1);
+            LinkedHashMap<String, Object> operand2 = 
+                    retrieveOperand(operandTree2);
+            // 'Proper' n_ary_linguistic_operators receive a considerably 
+            // different serialisation than 'commonparent' and 'commonancestor'
+            // For the latter cases, a dummy span is introduced and declared as
+            // a span class that has a dominance relation towards the two 
+            // operands, one after the other, thus resulting in two nested 
+            // relations! A Poliqarp+ equivalent for A $ B would be
             // contains(focus(1:contains({1:<>},A)), B).
             // This is modeled here...
-            if (reltype.equals("commonparent") || reltype.equals("commonancestor")) {
-                // make an (outer) group and an inner group containing the dummy node or previous relations
+            if (reltype.equals("commonparent") || 
+                    reltype.equals("commonancestor")) {
+                // make an (outer) group and an inner group containing the dummy 
+                // node or previous relations
                 group = KoralObjectGenerator.makeGroup("relation");
-                LinkedHashMap<String,Object> innerGroup = KoralObjectGenerator.makeGroup("relation");
-                LinkedHashMap<String,Object> relation = KoralObjectGenerator.makeRelation();
-                LinkedHashMap<String,Object> term = KoralObjectGenerator.makeTerm();
+                LinkedHashMap<String,Object> innerGroup = 
+                        KoralObjectGenerator.makeGroup("relation");
+                LinkedHashMap<String,Object> relation = 
+                        KoralObjectGenerator.makeRelation();
+                LinkedHashMap<String,Object> term = 
+                        KoralObjectGenerator.makeTerm();
                 term.put("layer", "c");
                 relation.put("wrap", term);
                 // commonancestor is an indirect commonparent relation
-                if (reltype.equals("commonancestor")) relation.put("boundary", KoralObjectGenerator.makeBoundary(1, null));
+                if (reltype.equals("commonancestor")) relation.put("boundary",
+                        KoralObjectGenerator.makeBoundary(1, null));
                 group.put("relation", relation);
                 innerGroup.put("relation", relation);
-                // Get operands list before possible re-assignment of 'group' (see following 'if')
-                ArrayList<Object> outerOperands  = (ArrayList<Object>) group.get("operands");
-                ArrayList<Object> innerOperands  = (ArrayList<Object>) innerGroup.get("operands");
-                // for lowest level, add the underspecified node as first operand and wrap it in a class group
+                // Get operands list before possible re-assignment of 'group' 
+                // (see following 'if')
+                ArrayList<Object> outerOperands  = 
+                        (ArrayList<Object>) group.get("operands");
+                ArrayList<Object> innerOperands  = 
+                        (ArrayList<Object>) innerGroup.get("operands");
+                // for lowest level, add the underspecified node as first 
+                // operand and wrap it in a class group
                 if (i == 1) {
-                    innerOperands.add(KoralObjectGenerator.wrapInClass(KoralObjectGenerator.makeSpan(), classCounter));
-                    // add the first operand and wrap the whole group in a focusing reference 
+                    innerOperands.add(KoralObjectGenerator.wrapInClass(
+                            KoralObjectGenerator.makeSpan(), classCounter+128));
+                    // add the first operand and wrap the whole group in a 
+                    // focusing reference 
                     innerOperands.add(operand1);
-                    innerGroup = KoralObjectGenerator.wrapInReference(innerGroup, classCounter, true);
+                    innerGroup = KoralObjectGenerator.
+                            wrapInReference(innerGroup, classCounter+128);
                     outerOperands.add(innerGroup);
                 } else {
                     outerOperands.add(operandStack.pop());
                 }
-                // Lookahead: if next operator is not commonparent or commonancestor, wrap in class for accessibility
-                if (i < node.getChildCount()-2 && !getNodeCat(node.getChild(i+2).getChild(0)).startsWith("common")) {
-                    operand2 = KoralObjectGenerator.wrapInClass(operand2, ++classCounter);
+                // Lookahead: if next operator is not commonparent or 
+                // commonancestor, wrap in class for accessibility
+                if (i < node.getChildCount()-2 && !getNodeCat(
+                        node.getChild(i+2).getChild(0)).startsWith("common")) {
+                    operand2 = KoralObjectGenerator.wrapInClass(
+                            operand2, ++classCounter+128);
                 }
                 outerOperands.add(operand2);
-
-                // Wrap in another reference object in case other relations are following
+                // Wrap in another reference object in case other relations
+                // are following
                 if (i < node.getChildCount()-2) {
-                    group = KoralObjectGenerator.wrapInReference(group, classCounter, true);
+                    group = KoralObjectGenerator.wrapInReference(
+                            group, classCounter+128);
                 }
-                // All other n-ary linguistic relations have special 'relation' attributes defined in CQLF and can be
-                // handled more easily...
+                // All other n-ary linguistic relations have special 'relation' 
+                // attributes defined in KoralQ. and can be handled more easily
             } else {
-                LinkedHashMap<String, Object> operatorGroup = parseOperatorNode(node.getChild(i).getChild(0));
+                LinkedHashMap<String, Object> operatorGroup = 
+                        parseOperatorNode(node.getChild(i).getChild(0));
                 String groupType;
                 try {
                     groupType = (String) operatorGroup.get("groupType");
                 } catch (ClassCastException | NullPointerException n) {
                     groupType = "relation";
                 }
-                if (groupType.equals("relation") || groupType.equals("treeRelation")) {
+                if (groupType.equals("relation") || 
+                        groupType.equals("treeRelation")) {
                     group = KoralObjectGenerator.makeGroup(groupType);
-                    LinkedHashMap<String, Object> relation = new LinkedHashMap<String, Object>();
+                    LinkedHashMap<String, Object> relation = 
+                            new LinkedHashMap<String, Object>();
                     putAllButGroupType(relation, operatorGroup);
                     group.put("relation", relation);
                 } else if (groupType.equals("sequence")) {
@@ -541,46 +635,67 @@
                     putAllButGroupType(group, operatorGroup);
                 }
 
-                // Get operands list before possible re-assignment of 'group' (see following 'if')
+                // Get operands list before possible re-assignment of 'group'
+                // (see following 'if')
                 operands  = (ArrayList<Object>) group.get("operands");
 
-                ParseTree leftChildSpec = getFirstChildWithCat(node.getChild(i).getChild(0), "@l");
-                ParseTree rightChildSpec = getFirstChildWithCat(node.getChild(i).getChild(0), "@r");
+                ParseTree leftChildSpec = getFirstChildWithCat(
+                        node.getChild(i).getChild(0), "@l");
+                ParseTree rightChildSpec = getFirstChildWithCat(
+                        node.getChild(i).getChild(0), "@r");
                 if (leftChildSpec != null || rightChildSpec != null) {
-                    String frame = (leftChildSpec!=null) ? "frames:startsWith" : "frames:endsWith";
-                    LinkedHashMap<String,Object> positionGroup = KoralObjectGenerator.makePosition(new String[]{frame});
-                    operand2 = KoralObjectGenerator.wrapInClass(operand2, ++classCounter);
-                    ((ArrayList<Object>) positionGroup.get("operands")).add(group);
-                    ((ArrayList<Object>) positionGroup.get("operands")).add(KoralObjectGenerator.makeReference(classCounter));
+                    String frame = (leftChildSpec!=null) ? 
+                            "frames:startsWith" : "frames:endsWith";
+                    LinkedHashMap<String,Object> positionGroup = 
+                            KoralObjectGenerator.
+                            makePosition(new String[]{frame});
+                    operand2 = KoralObjectGenerator.wrapInClass(
+                            operand2, ++classCounter+128);
+                    ((ArrayList<Object>) positionGroup.get("operands")).
+                            add(group);
+                    ((ArrayList<Object>) positionGroup.get("operands")).
+                            add(KoralObjectGenerator.
+                                    makeReference(classCounter+128));
                     group = positionGroup;
                 }
 
-                // Wrap in reference object in case other relations are following
+                // Wrap in reference object in case other relations follow
                 if (i < node.getChildCount()-2) {
-                    group = KoralObjectGenerator.wrapInReference(group, classCounter, true);
+                    group = KoralObjectGenerator.wrapInReference(
+                            group, classCounter+128);
                 }
 
                 // Inject operands.
                 // -> Case distinction:
                 if (node.getChildCount()==3) {
-                    // Things are easy when there's just one operator (thus 3 children incl. operands)...
+                    // Things are easy when there's just one operator 
+                    // (thus 3 children incl. operands)...
                     if (operand1 != null) operands.add(operand1);
                     if (operand2 != null) operands.add(operand2);
                 } else {
-                    // ... but things get a little more complicated here. The AST is of this form: (operand1 operator1 operand2 operator2 operand3 operator3 ...)
-                    // but we'll have to serialize it in a nested, binary way: (((operand1 operator1 operand2) operator2 operand3) operator3 ...)
-                    // the following code will do just that:
+                    // ... but things get a little more complicated here. The 
+                    // AST is of this form: (operand1 operator1 operand2 
+                    // operator2 operand3 operator3 ...), but we'll have
+                    // to serialize it in a nested, binary way: (((operand1 
+                    // operator1 operand2) operator2 operand3) operator3 ...).
+                    // The following code will do just that:
                     if (i == 1) {
                         // for the first operator, include both operands
                         if (operand1 != null) operands.add(operand1);
-                        if (operand2 != null) operands.add(KoralObjectGenerator.wrapInClass(operand2, classCounter++));
-                        // Don't put this into the super object directly but store on operandStack 
-                        // (because this group will have to be an operand of a subsequent operator)
+                        if (operand2 != null) operands.add(KoralObjectGenerator.
+                                wrapInClass(operand2, 128+classCounter++));
+                        // Don't put this into the super object directly but 
+                        // store on operandStack (because this group will have  
+                        // to be an operand of a subsequent operator)
                         operandStack.push(group);
-                        // for all subsequent operators, only take the 2nd operand (first was already added by previous operator)
+                        // for all subsequent operators, only take 2nd operand
+                        // (1st was already added by previous operator)
                     } else if (i < node.getChildCount()-2) {
-                        // for all intermediate operators, include other previous groups and 2nd operand. Store this on the operandStack, too.
-                        if (operand2 != null) operands.add(KoralObjectGenerator.wrapInClass(operand2, classCounter++));
+                        // for all intermediate operators, include other 
+                        // previous groups and 2nd operand. Store this on the
+                        // operandStack, too.
+                        if (operand2 != null) operands.add(KoralObjectGenerator.
+                                wrapInClass(operand2, 128+classCounter++));
                         operands.add(0, operandStack.pop());
                         operandStack.push(group);
                     } else if (i == node.getChildCount()-2) {
@@ -589,8 +704,10 @@
                     }
                 }
             }
-            // Final step: decide what to do with the 'group' object, depending on whether all relations have been processed
-            if (i == node.getChildCount()-2 && relationCounter == totalRelationCount) {
+            // Final step: decide what to do with the 'group' object, depending
+            // on whether all relations have been processed
+            if (i == node.getChildCount()-2 && 
+                    relationCounter == totalRelationCount) {
                 putIntoSuperObject(group);
                 if (!operandStack.isEmpty()) {
                     operands.add(0, operandStack.pop());
@@ -603,11 +720,10 @@
         }
     }
 
-
-
     /**
-     * Parses a unary_linguistic_operator node. Possible operators are: root, arity, tokenarity.
-     * Operators are embedded into a korap:term, in turn wrapped by an 'attr' property in a korap:span.
+     * Parses a unary_linguistic_operator node. Possible operators are: 
+     * root, arity, tokenarity. Operators are embedded into a korap:term,
+     * in turn wrapped by an 'attr' property in a korap:span.
      * @param node The unary_linguistic_operator node
      * @return A map containing the attr key, to be inserted into korap:span 
      */
@@ -615,7 +731,8 @@
         LinkedHashMap<String, Object> term = KoralObjectGenerator.makeTerm();
         String op = node.getChild(1).toStringTree(parser).substring(1);
         if (op.equals("arity") || op.equals("tokenarity")) {
-            LinkedHashMap<String, Object> boundary = boundaryFromRangeSpec(node.getChild(3), false);
+            LinkedHashMap<String, Object> boundary = 
+                    boundaryFromRangeSpec(node.getChild(3), false);
             term.put(op, boundary);
         } else {
             term.put(op, true);
@@ -624,63 +741,76 @@
     }
 
     @SuppressWarnings("unchecked")
-    private LinkedHashMap<String, Object> parseOperatorNode(ParseTree operatorNode) {
+    private LinkedHashMap<String, Object> parseOperatorNode(
+            ParseTree operatorNode) {
         LinkedHashMap<String, Object> relation = null;
         String operator = getNodeCat(operatorNode);
         // DOMINANCE
         if (operator.equals("dominance")) {
             relation = KoralObjectGenerator.makeRelation();
             relation.put("groupType", "relation");
-            ParseTree qName = getFirstChildWithCat(operatorNode, "qName");
-            ParseTree edgeSpecNode = getFirstChildWithCat(operatorNode, "edgeSpec");
+            ParseTree qName = getFirstChildWithCat(
+                    operatorNode, "qName");
+            ParseTree edgeSpecNode = getFirstChildWithCat(
+                    operatorNode, "edgeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
-            ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
-            LinkedHashMap<String,Object> term = KoralObjectGenerator.makeTerm();
+            ParseTree rangeSpec = getFirstChildWithCat(
+                    operatorNode, "rangeSpec");
+            LinkedHashMap<String,Object> term= KoralObjectGenerator.makeTerm();
             term.put("layer", "c");
             if (qName != null) term = parseQNameNode(qName);
             if (edgeSpecNode != null) {
-                LinkedHashMap<String,Object> edgeSpec = parseEdgeSpec(edgeSpecNode);
+                LinkedHashMap<String,Object> edgeSpec = 
+                        parseEdgeSpec(edgeSpecNode);
                 String edgeSpecType = (String) edgeSpec.get("@type");
                 if (edgeSpecType.equals("korap:termGroup")) {
                     ((ArrayList<Object>) edgeSpec.get("operands")).add(term);
                     term = edgeSpec;
                 } else {
                     term = KoralObjectGenerator.makeTermGroup("and");
-                    ArrayList<Object> termGroupOperands = (ArrayList<Object>) term.get("operands");
+                    ArrayList<Object> termGroupOperands = 
+                            (ArrayList<Object>) term.get("operands");
                     termGroupOperands.add(edgeSpec);
-                    LinkedHashMap<String,Object> constTerm = KoralObjectGenerator.makeTerm();
+                    LinkedHashMap<String,Object> constTerm = 
+                            KoralObjectGenerator.makeTerm();
                     constTerm.put("layer", "c");
                     termGroupOperands.add(constTerm);
                 }
             }
-            if (star != null) relation.put("boundary", KoralObjectGenerator.makeBoundary(0, null));
-            if (rangeSpec != null) relation.put("boundary", boundaryFromRangeSpec(rangeSpec));
+            if (star != null) relation.put("boundary", 
+                    KoralObjectGenerator.makeBoundary(0, null));
+            if (rangeSpec != null) relation.put("boundary", 
+                    boundaryFromRangeSpec(rangeSpec));
             relation.put("wrap", term);
         }
         else if (operator.equals("pointing")) {
-            //			String reltype = operatorNode.getChild(1).toStringTree(parser);
             relation = KoralObjectGenerator.makeRelation();
             relation.put("groupType", "relation");
             ParseTree qName = getFirstChildWithCat(operatorNode, "qName");
-            ParseTree edgeSpec = getFirstChildWithCat(operatorNode, "edgeSpec");
+            ParseTree edgeSpec = 
+                    getFirstChildWithCat(operatorNode, "edgeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
-            ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
-            //			if (qName != null) relation.putAll(parseQNameNode(qName));
-            LinkedHashMap<String,Object> term = KoralObjectGenerator.makeTerm();
+            ParseTree rangeSpec = 
+                    getFirstChildWithCat(operatorNode, "rangeSpec");
+            LinkedHashMap<String,Object> term= KoralObjectGenerator.makeTerm();
             if (qName != null) term.putAll(parseQNameNode(qName));
             if (edgeSpec != null) term.putAll(parseEdgeSpec(edgeSpec));
-            if (star != null) relation.put("boundary", KoralObjectGenerator.makeBoundary(0, null));
-            if (rangeSpec != null) relation.put("boundary", boundaryFromRangeSpec(rangeSpec));
+            if (star != null) relation.put("boundary",
+                    KoralObjectGenerator.makeBoundary(0, null));
+            if (rangeSpec != null) relation.put("boundary",
+                    boundaryFromRangeSpec(rangeSpec));
             relation.put("wrap", term);
         }
         else if (operator.equals("precedence")) {
             relation = new LinkedHashMap<String, Object>();
             relation.put("groupType", "sequence");
-            ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
+            ParseTree rangeSpec = 
+                    getFirstChildWithCat(operatorNode, "rangeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
             ArrayList<Object> distances = new ArrayList<Object>();
             if (star != null) {
-                distances.add(KoralObjectGenerator.makeDistance("w", 0, null));
+                distances.add(KoralObjectGenerator.
+                        makeDistance("w", 0, null));
                 relation.put("distances", distances);
             }
             if (rangeSpec != null) {
@@ -690,8 +820,6 @@
             relation.put("inOrder", true);
         }
         else if (operator.equals("spanrelation")) {
-            //			relation = makeGroup("position");
-            //			relation.put("groupType", "position");
             String reltype = operatorNode.getChild(0).toStringTree(parser);
             String[] frames = new String[]{};
             switch (reltype) {
@@ -699,16 +827,19 @@
                     frames = new String[]{"frames:matches"}; 
                     break;
                 case "_l_":
-                    frames = new String[]{"frames:startsWith", "frames:matches"};
+                    frames = new String[]{"frames:startsWith", 
+                            "frames:matches"};
                     break;
                 case "_r_":
-                    frames = new String[]{"frames:endsWith", "frames:matches"};
+                    frames = new String[]{"frames:endsWith", 
+                            "frames:matches"};
                     break;
                 case "_i_":
                     frames = new String[]{"frames:isAround"};
                     break;
                 case "_o_":
-                    frames = new String[]{"frames:overlapsLeft", "frames:overlapsRight"};
+                    frames = new String[]{"frames:overlapsLeft", 
+                            "frames:overlapsRight"};
                     break;
                 case "_ol_":
                     frames = new String[]{"frames:overlapsLeft"};
@@ -717,19 +848,19 @@
                     frames = new String[]{"frames:overlapsRight"};
                     break;
             }
-            //			relation.put("frames", frames);
-            //			relation.put("sharedClasses", sharedClasses);
             relation = KoralObjectGenerator.makePosition(frames);
             relation.put("groupType", "position");
         } 
         else if (operator.equals("near")) {
             relation = new LinkedHashMap<String, Object>();
             relation.put("groupType", "sequence");
-            ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
+            ParseTree rangeSpec = 
+                    getFirstChildWithCat(operatorNode, "rangeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
             ArrayList<Object> distances = new ArrayList<Object>();
             if (star != null) {
-                distances.add(KoralObjectGenerator.makeDistance("w", 0, null));
+                distances.add(KoralObjectGenerator.
+                        makeDistance("w", 0, null));
                 relation.put("distances", distances);
             }
             if (rangeSpec != null) {
@@ -755,8 +886,10 @@
         List<ParseTree> annos = getChildrenWithCat(edgeSpec, "edgeAnno");
         if (annos.size() == 1) return parseEdgeAnno(annos.get(0));
         else {
-            LinkedHashMap<String,Object> termGroup = KoralObjectGenerator.makeTermGroup("and");
-            ArrayList<Object> operands = (ArrayList<Object>) termGroup.get("operands");
+            LinkedHashMap<String,Object> termGroup = 
+                    KoralObjectGenerator.makeTermGroup("and");
+            ArrayList<Object> operands = 
+                    (ArrayList<Object>) termGroup.get("operands");
             for (ParseTree anno : annos) {
                 operands.add(parseEdgeAnno(anno));
             }
@@ -764,35 +897,45 @@
         }
     }
 
-    private LinkedHashMap<String, Object> parseEdgeAnno(ParseTree edgeAnnoSpec) {
-        LinkedHashMap<String, Object> edgeAnno = new LinkedHashMap<String, Object>();
+    private LinkedHashMap<String, Object> parseEdgeAnno(
+            ParseTree edgeAnnoSpec) {
+        LinkedHashMap<String, Object> edgeAnno =
+                new LinkedHashMap<String, Object>();
         edgeAnno.put("@type", "korap:term");
-        ParseTree textSpecNode = getFirstChildWithCat(edgeAnnoSpec, "textSpec");
+        ParseTree textSpecNode= getFirstChildWithCat(edgeAnnoSpec, "textSpec");
         ParseTree layerNode = getFirstChildWithCat(edgeAnnoSpec, "layer");
         ParseTree foundryNode = getFirstChildWithCat(edgeAnnoSpec, "foundry");
-        ParseTree matchOperatorNode = getFirstChildWithCat(edgeAnnoSpec, "eqOperator");
-        if (foundryNode!=null) edgeAnno.put("foundry", foundryNode.getChild(0).toStringTree(parser));
-        if (layerNode!=null) edgeAnno.put("layer", layerNode.getChild(0).toStringTree(parser));
+        ParseTree matchOperatorNode = 
+                getFirstChildWithCat(edgeAnnoSpec, "eqOperator");
+        if (foundryNode!=null) edgeAnno.put("foundry", 
+                foundryNode.getChild(0).toStringTree(parser));
+        if (layerNode!=null) edgeAnno.put("layer", 
+                layerNode.getChild(0).toStringTree(parser));
         edgeAnno.putAll(parseTextSpec(textSpecNode));
         edgeAnno.put("match", parseMatchOperator(matchOperatorNode));
         return edgeAnno;
     }
 
-    private LinkedHashMap<String, Object> boundaryFromRangeSpec(ParseTree rangeSpec) {
+    private LinkedHashMap<String, Object> boundaryFromRangeSpec(
+            ParseTree rangeSpec) {
         return boundaryFromRangeSpec(rangeSpec, true); 
     }
 
-    private LinkedHashMap<String, Object> boundaryFromRangeSpec(ParseTree rangeSpec, boolean expandToMax) {
-        Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
+    private LinkedHashMap<String, Object> boundaryFromRangeSpec(
+            ParseTree rangeSpec, boolean expandToMax) {
+        Integer min = Integer.parseInt(
+                rangeSpec.getChild(0).toStringTree(parser));
         Integer max = min;
         if (expandToMax) max = null;
         if (rangeSpec.getChildCount()==3) 
-            max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
+            max = Integer.parseInt(
+                    rangeSpec.getChild(2).toStringTree(parser));
         return KoralObjectGenerator.makeBoundary(min, max);
     }
 
     private LinkedHashMap<String, Object> parseDistance(ParseTree rangeSpec) {
-        Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
+        Integer min = 
+                Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
         Integer max = null;
         if (rangeSpec.getChildCount()==3) 
             max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
@@ -803,7 +946,8 @@
         LinkedHashMap<String, Object> term = new LinkedHashMap<String, Object>();
         if (hasChild(node, "regex")) {
             term.put("type", "type:regex");
-            term.put("key", node.getChild(0).getChild(0).toStringTree(parser).replaceAll("/", ""));
+            term.put("key", node.getChild(0).getChild(0).toStringTree(parser).
+                    replaceAll("/", ""));
         } else {
             term.put("key", node.getChild(1).toStringTree(parser));
         }
@@ -818,16 +962,19 @@
      */
     private String parseMatchOperator(ParseTree node) {
         if (node.getChildCount()>0) {
-            return node.getChild(0).getText().equals("=") ? "match:eq" : "match:ne";
+            return node.getChild(0).getText().equals("=") ? 
+                    "match:eq" : "match:ne";
         }
         return "match:eq";
     }
 
     private LinkedHashMap<String, Object> parseQNameNode(ParseTree node) {
-        LinkedHashMap<String, Object> fields = new LinkedHashMap<String, Object>();
+        LinkedHashMap<String, Object> fields = 
+                new LinkedHashMap<String, Object>();
         ParseTree layerNode = getFirstChildWithCat(node, "layer");
         ParseTree foundryNode = getFirstChildWithCat(node, "foundry");
-        if (foundryNode != null) fields.put("foundry", foundryNode.getChild(0).toStringTree(parser));
+        if (foundryNode != null) fields.put("foundry", 
+                foundryNode.getChild(0).toStringTree(parser));
         String layer = layerNode.getChild(0).toStringTree(parser);
         if (layer.equals("pos")) layer = "p";
         if (layer.equals("cat")) layer = "c";
@@ -840,9 +987,11 @@
     }
 
     @SuppressWarnings({ "unchecked" })
-    private void putIntoSuperObject(LinkedHashMap<String, Object> object, int objStackPosition) {
+    private void putIntoSuperObject(
+            LinkedHashMap<String, Object> object, int objStackPosition) {
         if (objectStack.size()>objStackPosition) {
-            ArrayList<Object> topObjectOperands = (ArrayList<Object>) objectStack.get(objStackPosition).get("operands");
+            ArrayList<Object> topObjectOperands = (ArrayList<Object>) 
+                    objectStack.get(objStackPosition).get("operands");
             if (!invertedOperandsLists.contains(topObjectOperands)) {
                 topObjectOperands.add(object);
             } else {
@@ -853,7 +1002,8 @@
         }
     }
 
-    private void putAllButGroupType(Map<String, Object> container, Map<String, Object> input) {
+    private void putAllButGroupType(
+            Map<String, Object> container, Map<String, Object> input) {
         for (String key : input.keySet()) {
             if (!key.equals("groupType")) {
                 container.put(key, input.get(key));
@@ -864,7 +1014,8 @@
     private ParserRuleContext parseAnnisQuery (String query) {
         Lexer lexer = new AqlLexer((CharStream)null);
         ParserRuleContext tree = null;
-        Antlr4DescriptiveErrorListener errorListener = new Antlr4DescriptiveErrorListener(query);
+        Antlr4DescriptiveErrorListener errorListener = 
+                new Antlr4DescriptiveErrorListener(query);
         // Like p. 111
         try {
             // Tokenize input data
@@ -880,11 +1031,12 @@
             parser.addErrorListener(errorListener);
             // Get starting rule from parser
             Method startRule = AqlParser.class.getMethod("start"); 
-            tree = (ParserRuleContext) startRule.invoke(parser, (Object[])null);
+            tree = (ParserRuleContext)startRule.invoke(parser, (Object[])null);
         }
         // Some things went wrong ...
         catch (Exception 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.");
             log.error(errorListener.generateFullErrorMsg().toString());
             addError(errorListener.generateFullErrorMsg());
         }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
index 822d022..3750220 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
@@ -8,17 +8,31 @@
 import org.antlr.runtime.Parser;
 import org.antlr.runtime.tree.Tree;
 
+/**
+ * This class is provides methods for navigation and search in Abstract Syntax
+ * Trees returned by ANTLR v3 parsers, using ANTLR v3 libraries. Any class that
+ * extends this abstract class will thus be equipped with such methods,
+ * which makes it easier to, e.g., retrieve children of a specific category
+ * for some node. 
+ * 
+ * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @version 0.1.0
+ * @since 0.1.0
+ */
 public abstract class Antlr3AbstractQueryProcessor extends
         AbstractQueryProcessor {
 
+    /**
+     * The ANTLR parser. Subclasses need to instantiate this field.
+     */
     protected Parser parser;
 
     /**
      * Returns the category (or 'label') of the root of a (sub-)
      * ParseTree (ANTLR 3).
      *
-     * @param node
-     * @return
+     * @param node The tree node. 
+     * @return The category of the node.
      */
     protected static String getNodeCat(Tree node) {
         String nodeCat = node.toStringTree();
@@ -32,14 +46,14 @@
     }
 
     /**
-     * Tests whether a certain node has a child by a certain name
+     * Tests whether a certain node has a child of a certain category.
      *
      * @param node
      *            The parent node.
      * @param childCat
      *            The category of the potential child.
      * @return true iff one or more children belong to the specified
-     *         category
+     *         category.
      */
     protected static boolean hasChild(Tree node, String childCat) {
         for (int i = 0; i < node.getChildCount(); i++) {
@@ -50,6 +64,17 @@
         return false;
     }
 
+    /**
+     * Tests whether a certain node has a descendant (direct or indirect child)
+     * of a certain category.
+     *
+     * @param node
+     *            The parent node.
+     * @param childCat
+     *            The category of the potential descendant.
+     * @return true iff one or more descendants belong to the specified
+     *         category.
+     */
     protected static boolean hasDescendantWithCat(Tree node, String childCat) {
         for (int i = 0; i < node.getChildCount(); i++) {
             Tree child = node.getChild(i);
@@ -63,6 +88,11 @@
         return false;
     }
 
+    /**
+     * Returns all children of a node.
+     * @param node The node.
+     * @return A list containing all children. 
+     */
     protected static List<Tree> getChildren(Tree node) {
         ArrayList<Tree> children = new ArrayList<Tree>();
         for (int i = 0; i < node.getChildCount(); i++) {
@@ -71,6 +101,13 @@
         return children;
     }
 
+    /**
+     * Returns all children of a node which are of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned children. 
+     * @return A (possibly empty) list containing all children of the given
+     *      category. 
+     */
     protected static List<Tree> getChildrenWithCat(Tree node, String nodeCat) {
         ArrayList<Tree> children = new ArrayList<Tree>();
         for (int i = 0; i < node.getChildCount(); i++) {
@@ -81,11 +118,47 @@
         return children;
     }
 
+    /**
+     * Returns all descendants (direct or indirect children) of a node which
+     * are of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned descendants. 
+     * @return A (possibly empty) list containing all descendants of the given
+     *      category. 
+     */
+    protected List<Tree> getDescendantsWithCat(Tree node, String nodeCat) {
+        ArrayList<Tree> descendants = new ArrayList<Tree>();
+        for (Tree child : getChildren(node)) {
+            if (getNodeCat(child).equals(nodeCat)) {
+                descendants.add(child);
+            }
+            descendants.addAll(getDescendantsWithCat(child, nodeCat));
+        }
+        return descendants;
+    }
+    
+    /**
+     * Returns the first child of a node which is of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned child. 
+     * @return The first child with the given category, <tt>null</tt> if no
+     *      such child exists. 
+     */
     protected static Tree getFirstChildWithCat(Tree node, String nodeCat) {
         return getNthChildWithCat(node, nodeCat, 1);
     }
 
-    protected static Tree getNthChildWithCat(Tree node, String nodeCat, int n) {
+    /**
+     * Returns the nth child of a node which is of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned child. 
+     * @param n The index of the child to return, among all children with the
+     *      given category.
+     * @return The nth child with the given category, <tt>null</tt> if no
+     *      such child exists (i.e., if n is larger than the number of children
+     *      with the given category). 
+     */
+    protected static Tree getNthChildWithCat(Tree node,String nodeCat, int n) {
         int counter = 0;
         for (int i = 0; i < node.getChildCount(); i++) {
             if (getNodeCat(node.getChild(i)).equals(nodeCat)) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
index 517338e..324d25e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
@@ -8,22 +8,37 @@
 import org.antlr.v4.runtime.Parser;
 import org.antlr.v4.runtime.tree.ParseTree;
 
-public abstract class Antlr4AbstractQueryProcessor extends AbstractQueryProcessor {
+/**
+ * This class is provides methods for navigation and search in Abstract Syntax
+ * Trees returned by ANTLR v4 parsers, using ANTLR v4 libraries. Any class that
+ * extends this abstract class will thus be equipped with such methods,
+ * which makes it easier to, e.g., retrieve children of a specific category
+ * for some node. 
+ * 
+ * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @version 0.1.0
+ * @since 0.1.0
+ */
+public abstract class Antlr4AbstractQueryProcessor extends  
+        AbstractQueryProcessor {
 
-	/**
-	 * Parser object deriving the ANTLR parse tree.
-	 */
+    /**
+     * The ANTLR parser. Subclasses need to instantiate this field such that it
+     * can be used in the methods of this class.
+     */
 	protected Parser parser;
 
 	 /**
-     * Returns the category (or 'label') of the root of a (sub-) ParseTree (ANTLR 4).
+     * Returns the category (or 'label') of the root of a (sub-) 
+     * ParseTree (ANTLR 4).
      *
-     * @param node
-     * @return
+     * @param node The tree node. 
+     * @return The category of the node.
      */
 	protected String getNodeCat(ParseTree node) {
         String nodeCat = node.toStringTree(parser);
-        Pattern p = Pattern.compile("\\((.*?)\\s"); // from opening parenthesis to 1st whitespace
+        // pattern: from opening parenthesis to 1st whitespace
+        Pattern p = Pattern.compile("\\((.*?)\\s"); 
         Matcher m = p.matcher(node.toStringTree(parser));
         if (m.find()) {
             nodeCat = m.group(1);
@@ -31,12 +46,15 @@
         return nodeCat;
     }
     
-    /**
-     * Tests whether a certain node has a child by a certain name
+	/**
+     * Tests whether a certain node has a child of a certain category.
      *
-     * @param node     The parent node.
-     * @param childCat The category of the potential child.
-     * @return true iff one or more children belong to the specified category
+     * @param node
+     *            The parent node.
+     * @param childCat
+     *            The category of the potential child.
+     * @return true iff one or more children belong to the specified
+     *         category.
      */
     protected boolean hasChild(ParseTree node, String childCat) {
         for (int i = 0; i < node.getChildCount(); i++) {
@@ -47,6 +65,17 @@
         return false;
     }
 
+    /**
+     * Tests whether a certain node has a descendant (direct or indirect child)
+     * of a certain category.
+     *
+     * @param node
+     *            The parent node.
+     * @param childCat
+     *            The category of the potential descendant.
+     * @return true iff one or more descendants belong to the specified
+     *         category.
+     */
     protected boolean hasDescendantWithCat(ParseTree node, String childCat) {
         for (int i = 0; i < node.getChildCount(); i++) {
             ParseTree child = node.getChild(i);
@@ -60,7 +89,11 @@
         return false;
     }
     
-
+    /**
+     * Returns all children of a node.
+     * @param node The node.
+     * @return A list containing all children. 
+     */
     protected List<ParseTree> getChildren(ParseTree node) {
         ArrayList<ParseTree> children = new ArrayList<ParseTree>();
         for (int i = 0; i < node.getChildCount(); i++) {
@@ -69,7 +102,15 @@
         return children;
     }
     
-    protected List<ParseTree> getChildrenWithCat(ParseTree node, String nodeCat) {
+    /**
+     * Returns all children of a node which are of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned children. 
+     * @return A (possibly empty) list containing all children of the given
+     *      category. 
+     */
+    protected List<ParseTree> getChildrenWithCat(ParseTree node, 
+            String nodeCat) {
         ArrayList<ParseTree> children = new ArrayList<ParseTree>();
         for (int i = 0; i < node.getChildCount(); i++) {
             if (getNodeCat(node.getChild(i)).equals(nodeCat)) {
@@ -79,7 +120,16 @@
         return children;
     }
     
-    protected List<ParseTree> getDescendantsWithCat(ParseTree node, String nodeCat) {
+    /**
+     * Returns all descendants (direct or indirect children) of a node which
+     * are of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned descendants. 
+     * @return A (possibly empty) list containing all descendants of the given
+     *      category. 
+     */
+    protected List<ParseTree> getDescendantsWithCat(ParseTree node, 
+            String nodeCat) {
         ArrayList<ParseTree> descendants = new ArrayList<ParseTree>();
         for (ParseTree child : getChildren(node)) {
             if (getNodeCat(child).equals(nodeCat)) {
@@ -90,11 +140,29 @@
         return descendants;
     }
 
+    /**
+     * Returns the first child of a node which is of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned child. 
+     * @return The first child with the given category, <tt>null</tt> if no
+     *      such child exists. 
+     */
     protected ParseTree getFirstChildWithCat(ParseTree node, String nodeCat) {
         return getNthChildWithCat(node, nodeCat, 1);
     }
     
-    protected ParseTree getNthChildWithCat(ParseTree node, String nodeCat, int n) {
+    /**
+     * Returns the nth child of a node which is of a given category.
+     * @param node The node.
+     * @param nodeCat The node category constraining the returned child. 
+     * @param n The index of the child to return, among all children with the
+     *      given category.
+     * @return The nth child with the given category, <tt>null</tt> if no
+     *      such child exists (i.e., if n is larger than the number of children
+     *      with the given category). 
+     */
+    protected ParseTree getNthChildWithCat(ParseTree node, String nodeCat, 
+            int n) {
     	int counter = 0;
     	for (int i = 0; i < node.getChildCount(); i++) {
     		if (getNodeCat(node.getChild(i)).equals(nodeCat)) {
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 acad4d6..a884171 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
@@ -17,30 +17,21 @@
 import java.util.regex.Pattern;
 
 /**
- * @author hanl, bingel
- * @date 06/12/2013
+ * This class processes queries that define virtual collections and create
+ * an KoralQuery representation of these in the <tt>collection</tt> attribute
+ * of the KoralQuery tree. See the official documentation for VC query syntax
+ * and functionality.
+ * 
+ * @author Michael Hanl (hanl@ids-mannheim.de)
+ * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @version 0.1.0
+ * @since 0.1.0
  */
 public class CollectionQueryProcessor extends Antlr4AbstractQueryProcessor {
 
-	private static Logger log = LoggerFactory.getLogger(CollectionQueryProcessor.class);
-    private Parser parser;
-    private static boolean verbose;
-    private List<ParseTree> visited = new ArrayList<ParseTree>();
+	private static Logger log = 
+	        LoggerFactory.getLogger(CollectionQueryProcessor.class);
 
-    /**
-     * Keeps track of active object.
-     */
-    LinkedList<LinkedHashMap<String, Object>> objectStack = new LinkedList<LinkedHashMap<String, Object>>();
-    /**
-     * Keeps track of open node categories
-     */
-    LinkedList<String> openNodeCats = new LinkedList<String>();
-    /**
-     * Keeps track of how many objects there are to pop after every recursion of {@link #processNode(ParseTree)}
-     */
-    LinkedList<Integer> objectsToPop = new LinkedList<Integer>();
-    Integer stackedObjects = 0;
-    
     public CollectionQueryProcessor() {
     	KoralObjectGenerator.setQueryProcessor(this);
 	}
@@ -61,15 +52,17 @@
         if (this.parser != null) {
             super.parser = this.parser;
         } else {
-            throw new NullPointerException("Parser has not been instantiated!");
+            throw new NullPointerException(
+                    "Parser has not been instantiated!");
         }
-        log.info("Processing collection query: "+query);
+        log.info("Processing virtual collection query: "+query);
         if (verbose) System.out.println(tree.toStringTree(parser));
         if (tree != null) {
 			log.debug("ANTLR parse tree: "+tree.toStringTree(parser));
 			processNode(tree);
 		} else {
-			addError(StatusCodes.MALFORMED_QUERY, "Could not parse query >>> "+query+" <<<.");
+			addError(StatusCodes.MALFORMED_QUERY, 
+			        "Could not parse query >>> "+query+" <<<.");
 		}
     }
 
@@ -93,8 +86,10 @@
 		 */
 
         if (nodeCat.equals("relation")) {
-        	String operator = node.getChild(1).getChild(0).toStringTree(parser).equals("&") ? "and" : "or"; 
-            LinkedHashMap<String, Object> relationGroup = KoralObjectGenerator.makeDocGroup(operator);
+        	String operator = getNodeCat(node.getChild(1).getChild(0))
+        	        .equals("&") ? "and" : "or";
+            LinkedHashMap<String, Object> relationGroup = 
+                    KoralObjectGenerator.makeDocGroup(operator);
             putIntoSuperObject(relationGroup);
             objectStack.push(relationGroup);
             stackedObjects++;
@@ -105,7 +100,8 @@
             String field = fieldNode.getChild(0).toStringTree(parser);
             ParseTree operatorNode = getFirstChildWithCat(node, "operator");
             ParseTree valueNode = getFirstChildWithCat(node, "value");
-            LinkedHashMap<String, Object> term = KoralObjectGenerator.makeDoc();
+            LinkedHashMap<String, Object> term = 
+                    KoralObjectGenerator.makeDoc();
             term.put("key", field);
             term.putAll(parseValue(valueNode));
             String match = operatorNode.getText();
@@ -115,9 +111,12 @@
             	return;
             }
             if (checkDateValidity(valueNode)) {
-        		addWarning("The collection query contains a value that looks like a date ('"+valueNode.getText()+"')"
-        				+ " and an operator that is only defined for strings ('"+match+"'). The value is interpreted as "
-        						+ "a string. Use a date operator to ensure the value is treated as a date");            	
+        		addWarning("The collection query contains a value that looks"
+        		        + " like a date ('"+valueNode.getText()+"') and an"
+        				+ " operator that is only defined for strings"
+        				+ " ('"+match+"'). The value is interpreted as"
+        				+ " a string. Use a date operator to ensure the value"
+        				+ " is treated as a date");            	
             }
             putIntoSuperObject(term);
         }
@@ -128,7 +127,8 @@
             ParseTree dateOpNode = getFirstChildWithCat(node, "dateOp");
             ParseTree dateNode = getFirstChildWithCat(node, "date");
 
-            LinkedHashMap<String, Object> term = KoralObjectGenerator.makeDoc();
+            LinkedHashMap<String, Object> term = 
+                    KoralObjectGenerator.makeDoc();
             term.put("key", field);
             term.putAll(parseValue(dateNode));
             String match = dateOpNode.getText();
@@ -141,7 +141,8 @@
         }
         
         if (nodeCat.equals("token")) {
-			LinkedHashMap<String,Object> token = KoralObjectGenerator.makeToken();
+			LinkedHashMap<String,Object> token = 
+			        KoralObjectGenerator.makeToken();
 			// handle negation
 			List<ParseTree> negations = getChildrenWithCat(node, "!");
 			boolean negated = false;
@@ -149,7 +150,8 @@
 			if (negations.size() % 2 == 1) negated = true;
 			if (getNodeCat(node.getChild(0)).equals("key")) {
 				// no 'term' child, but direct key specification: process here
-				LinkedHashMap<String,Object> term = KoralObjectGenerator.makeTerm();
+				LinkedHashMap<String,Object> term = 
+				        KoralObjectGenerator.makeTerm();
 				String key = node.getChild(0).getText();
 				if (getNodeCat(node.getChild(0).getChild(0)).equals("regex")) {
 					isRegex = true;
@@ -162,9 +164,12 @@
 				term.put("match", "match:"+matches);
 				ParseTree flagNode = getFirstChildWithCat(node, "flag");
 				if (flagNode != null) {
-					String flag = getNodeCat(flagNode.getChild(0)).substring(1); //substring removes leading slash '/'
-					if (flag.contains("i")) term.put("caseInsensitive", true);
-					else if (flag.contains("I")) term.put("caseInsensitive", false);
+				    // substring removes leading slash '/'
+					String flag = getNodeCat(flagNode.getChild(0)).substring(1); 
+					if (flag.contains("i")) 
+					    term.put("caseInsensitive", true);
+					else if (flag.contains("I")) 
+					    term.put("caseInsensitive", false);
 					if (flag.contains("x")) {
 						term.put("type", "type:regex");
 						if (!isRegex) {
@@ -176,14 +181,14 @@
 				token.put("wrap", term);
 			} else {
 				// child is 'term' or 'termGroup' -> process in extra method 
-				LinkedHashMap<String,Object> termOrTermGroup = parseTermOrTermGroup(node.getChild(1), negated);
+				LinkedHashMap<String,Object> termOrTermGroup = 
+				        parseTermOrTermGroup(node.getChild(1), negated);
 				token.put("wrap", termOrTermGroup);
 			}
 			putIntoSuperObject(token);
 			visited.add(node.getChild(0));
 			visited.add(node.getChild(2));
 		}
-
         objectsToPop.push(stackedObjects);
 
 		/*
@@ -215,14 +220,20 @@
     }
 
 	/**
-	 * Checks whether the combination of operator and value is legal (inequation operators <,>,<=,>= may only be used with dates).
+	 * Checks whether the combination of operator and value is legal 
+	 * (inequation operators <,>,<=,>= may only be used with dates).
 	 */
-    private boolean checkOperatorValueConformance(LinkedHashMap<String, Object> term) {
+    private boolean checkOperatorValueConformance(
+            LinkedHashMap<String, Object> term) {
 		String match = (String) term.get("match");
 		String type = (String) term.get("type");
 		if (type == null || type.equals("type:regex")) {
-			if (!(match.equals("match:eq") || match.equals("match:ne") || match.equals("match:contains") || match.equals("match:containsnot"))) {
-				addError(StatusCodes.INCOMPATIBLE_OPERATOR_AND_OPERAND, "You used an inequation operator with a string value.");
+			if (!(match.equals("match:eq") 
+			        || match.equals("match:ne") 
+			        || match.equals("match:contains") 
+			        || match.equals("match:containsnot"))) {
+				addError(StatusCodes.INCOMPATIBLE_OPERATOR_AND_OPERAND, 
+				       "You used an inequation operator with a string value.");
 				return false;
 			}
 		}
@@ -230,13 +241,15 @@
 	}
 
 	private LinkedHashMap<String, Object> parseValue(ParseTree valueNode) {
-    	LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
+    	LinkedHashMap<String, Object> map = 
+    	        new LinkedHashMap<String, Object>();
     	if (getNodeCat(valueNode).equals("date")) {
     		map.put("type", "type:date");
     		checkDateValidity(valueNode);
     	}
     	if (getNodeCat(valueNode.getChild(0)).equals("regex")) {
-    		String regex = valueNode.getChild(0).getChild(0).toStringTree(parser);
+    		String regex = 
+    		        valueNode.getChild(0).getChild(0).toStringTree(parser);
     		map.put("value", regex.substring(1, regex.length()-1));
     		map.put("type", "type:regex");
     	} else if (getNodeCat(valueNode.getChild(0)).equals("multiword")) {
@@ -316,7 +329,8 @@
                 break;
             default:
             	out = match;
-            	addError(StatusCodes.UNKNOWN_QUERY_ELEMENT, "Unknown operator '"+match+"'.");
+            	addError(StatusCodes.UNKNOWN_QUERY_ELEMENT, 
+            	        "Unknown operator '"+match+"'.");
             	break;
         }
         return out;
@@ -347,9 +361,11 @@
     }
 
     @SuppressWarnings({"unchecked"})
-    private void putIntoSuperObject(LinkedHashMap<String, Object> object, int objStackPosition) {
+    private void putIntoSuperObject(LinkedHashMap<String, Object> object, 
+            int objStackPosition) {
         if (objectStack.size() > objStackPosition) {
-            ArrayList<Object> topObjectOperands = (ArrayList<Object>) objectStack.get(objStackPosition).get("operands");
+            ArrayList<Object> topObjectOperands = (ArrayList<Object>) 
+                    objectStack.get(objStackPosition).get("operands");
             topObjectOperands.add(object);
         } else {
 //        	requestMap = object;
@@ -365,15 +381,18 @@
     /**
 	 * Parses a (term) or (termGroup) node
 	 * @param node
-	 * @param negatedGlobal Indicates whether the term/termGroup is globally negated, e.g. through a negation 
-	 * operator preceding the related token like "![base=foo]". Global negation affects the term's "match" parameter.
+	 * @param negatedGlobal Indicates whether the term/termGroup is globally 
+	 * negated, e.g. through a negation operator preceding the related token  
+	 * like "![base=foo]". Global negation affects the "match" parameter.
 	 * @return A term or termGroup object, depending on input
 	 */
 	@SuppressWarnings("unchecked")
-	private LinkedHashMap<String, Object> parseTermOrTermGroup(ParseTree node, boolean negatedGlobal, String mode) {
+	private LinkedHashMap<String, Object> parseTermOrTermGroup(
+	        ParseTree node, boolean negatedGlobal, String mode) {
 		if (getNodeCat(node).equals("term")) {
 			String key = null;
-			LinkedHashMap<String,Object> term = KoralObjectGenerator.makeTerm();
+			LinkedHashMap<String,Object> term = 
+			        KoralObjectGenerator.makeTerm();
 			// handle negation
 			boolean negated = negatedGlobal;
 			boolean isRegex = false;
@@ -387,7 +406,8 @@
 			ParseTree termOpNode = getFirstChildWithCat(node, "termOp");
 			ParseTree flagNode = getFirstChildWithCat(node, "flag");
 			// process foundry
-			if (foundryNode != null) term.put("foundry", foundryNode.getText());
+			if (foundryNode != null) 
+			    term.put("foundry", foundryNode.getText());
 			// process layer: map "base" -> "lemma"
 			if (layerNode != null) {
 				String layer = layerNode.getText();
@@ -400,7 +420,8 @@
 			if (getNodeCat(keyNode.getChild(0)).equals("regex")) {
 				isRegex = true;
 				term.put("type", "type:regex");
-				key = key.substring(1, key.length()-1); // remove leading and trailing slashes
+				// remove leading and trailing slashes
+				key = key.substring(1, key.length()-1); 
 			}
 			if (mode.equals("span")) term.put("value", key);
 			else term.put("key", key);
@@ -415,34 +436,40 @@
 			}
 			// process possible flags
 			if (flagNode != null) {
-				String flag = getNodeCat(flagNode.getChild(0)).substring(1); //substring removes leading slash '/'
+			    // substring removes leading slash '/'
+				String flag = getNodeCat(flagNode.getChild(0)).substring(1); 
 				if (flag.contains("i")) term.put("caseInsensitive", true);
 				else if (flag.contains("I")) term.put("caseInsensitive", false);
 				if (flag.contains("x")) {
 					if (!isRegex) {
 						key = QueryUtils.escapeRegexSpecialChars(key); 
 					}
-					term.put("key", ".*?"+key+".*?");  // flag 'x' allows submatches: overwrite key with appended .*? 
+					// flag 'x' allows submatches: append .*? to key
+					term.put("key", ".*?"+key+".*?");   
 					term.put("type", "type:regex");
 				}
 			}
 			return term;
 		} else {
-			// For termGroups, establish a boolean relation between operands and recursively call this function with
-			// the term or termGroup operands
+			// For termGroups, establish a boolean relation between operands 
+		    // and recursively call this function with the term or termGroup 
+			// operands.
 			LinkedHashMap<String,Object> termGroup = null;
 			ParseTree leftOp = null;
 			ParseTree rightOp = null;
 			// check for leading/trailing parantheses
-			if (!getNodeCat(node.getChild(0)).equals("(")) leftOp = node.getChild(0);
+			if (!getNodeCat(node.getChild(0)).equals("(")) 
+			    leftOp = node.getChild(0);
 			else leftOp = node.getChild(1);
-			if (!getNodeCat(node.getChild(node.getChildCount()-1)).equals(")")) rightOp = node.getChild(node.getChildCount()-1);
+			if (!getNodeCat(node.getChild(node.getChildCount()-1)).equals(")")) 
+			    rightOp = node.getChild(node.getChildCount()-1);
 			else 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);
-			ArrayList<Object> operands = (ArrayList<Object>) termGroup.get("operands");
+			ArrayList<Object> operands = 
+			        (ArrayList<Object>) termGroup.get("operands");
 			// recursion with left/right operands
 			operands.add(parseTermOrTermGroup(leftOp, negatedGlobal, mode));
 			operands.add(parseTermOrTermGroup(rightOp, negatedGlobal, mode));
@@ -453,7 +480,8 @@
     private ParserRuleContext parseCollectionQuery(String query) {
         Lexer lexer = new CollectionQueryLexer((CharStream) null);
         ParserRuleContext tree = null;
-        Antlr4DescriptiveErrorListener errorListener = new Antlr4DescriptiveErrorListener(query);
+        Antlr4DescriptiveErrorListener errorListener = 
+                new Antlr4DescriptiveErrorListener(query);
         // Like p. 111
         try {
 
@@ -471,7 +499,8 @@
             parser.addErrorListener(errorListener);
             // Get starting rule from parser
             Method startRule = CollectionQueryParser.class.getMethod("start");
-            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/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
index d8b0196..add2e16 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
@@ -262,12 +262,12 @@
         assertEquals("S",					res.at("/query/operands/0/operands/0/key").asText());
         assertEquals("korap:group",			res.at("/query/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",		res.at("/query/operands/0/operands/1/operation").asText());
-        assertEquals(2,					    res.at("/query/operands/0/operands/1/classOut").asInt());
+        assertEquals(130,				    res.at("/query/operands/0/operands/1/classOut").asInt());
         assertEquals("korap:span",			res.at("/query/operands/0/operands/1/operands/0/@type").asText());
         assertEquals("NP",					res.at("/query/operands/0/operands/1/operands/0/key").asText());
         assertEquals("korap:reference",		res.at("/query/operands/1/@type").asText());
         assertEquals("operation:focus",		res.at("/query/operands/1/operation").asText());
-        assertEquals(2,					    res.at("/query/operands/1/classRef/0").asInt());
+        assertEquals(130,				    res.at("/query/operands/1/classRef/0").asInt());
 
         query = "cat=\"S\" & cat=\"NP\" & #1 >@r #2";  
         qs.setQuery(query, "annis");
@@ -279,12 +279,12 @@
         assertEquals("S",					res.at("/query/operands/0/operands/0/key").asText());
         assertEquals("korap:group",			res.at("/query/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",		res.at("/query/operands/0/operands/1/operation").asText());
-        assertEquals(2,					    res.at("/query/operands/0/operands/1/classOut").asInt());
+        assertEquals(130,					res.at("/query/operands/0/operands/1/classOut").asInt());
         assertEquals("korap:span",			res.at("/query/operands/0/operands/1/operands/0/@type").asText());
         assertEquals("NP",					res.at("/query/operands/0/operands/1/operands/0/key").asText());
         assertEquals("korap:reference",		res.at("/query/operands/1/@type").asText());
         assertEquals("operation:focus",		res.at("/query/operands/1/operation").asText());
-        assertEquals(2,					    res.at("/query/operands/1/classRef/0").asInt());
+        assertEquals(130,					res.at("/query/operands/1/classRef/0").asInt());
     }
 
     @Test
@@ -319,7 +319,7 @@
         assertEquals("operation:relation",	res.at("/query/operation").asText());
         assertEquals("korap:reference",		res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",		res.at("/query/operands/0/operation").asText());
-        assertEquals(1,					    res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,   			    res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",			res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",	res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:relation",		res.at("/query/operands/0/operands/0/relation/@type").asText());
@@ -329,7 +329,7 @@
         assertEquals("CP",					res.at("/query/operands/0/operands/0/operands/0/key").asText());
         assertEquals("korap:group",			res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",		res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,					    res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,   			    res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("VP",					res.at("/query/operands/0/operands/0/operands/1/operands/0/key").asText());
     }
     //		query = "cat=\"CP\" & cat=\"VP\" & cat=\"NP\" & #1 > #2 > #3";
@@ -479,7 +479,7 @@
         assertEquals("korap:group",         res.at("/query/@type").asText());
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals(res.at("/query/operands/0/classRef/0").asInt(), 
                 res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
     }
@@ -603,14 +603,14 @@
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:token",         res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("Sonne",               res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("Mond",                res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
         assertEquals("Sterne",              res.at("/query/operands/1/wrap/key").asText());
         assertEquals("w",                   res.at("/query/distances/0/key").asText());
@@ -624,14 +624,14 @@
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:token",         res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("Sonne",               res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("Mond",                res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
         assertEquals("Sterne",              res.at("/query/operands/1/wrap/key").asText());
         assertEquals("w",                   res.at("/query/distances/0/key").asText());
@@ -645,21 +645,21 @@
         assertEquals("operation:relation",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(2,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(130,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operands/0/operands/0/operation").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/classOut").asInt());
         assertEquals("korap:span",          res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("NP",                  res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/key").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(2,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(130,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("VP",                  res.at("/query/operands/0/operands/0/operands/1/operands/0/key").asText());
         assertEquals("PP",                  res.at("/query/operands/1/key").asText());
 
@@ -674,19 +674,19 @@
         assertEquals("frames:startsWith",   res.at("/query/frames/0").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
         assertEquals("korap:span",          res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("NP",                  res.at("/query/operands/0/operands/0/operands/0/operands/0/key").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(2,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(130,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("VP",                  res.at("/query/operands/0/operands/0/operands/1/operands/0/key").asText());
         assertEquals("korap:reference",     res.at("/query/operands/1/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/1/operation").asText());
-        assertEquals(2,  res.at("/query/operands/1/classRef/0").asInt());
+        assertEquals(130,                   res.at("/query/operands/1/classRef/0").asInt());
 
     }
     @Test
@@ -744,12 +744,12 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("frames:startsWith",   res.at("/query/frames/0").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("frames:endsWith",     res.at("/query/operands/0/operands/0/frames/0").asText());
         assertEquals("korap:span",          res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("VP",                  res.at("/query/operands/0/operands/0/operands/1/operands/0/key").asText());
         assertEquals("NP",                  res.at("/query/operands/1/key").asText());
 
@@ -787,14 +787,14 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("operation:sequence",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:token",         res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("p",                   res.at("/query/operands/0/operands/0/operands/0/wrap/layer").asText());
         assertEquals("N",                   res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,                   res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("V",                   res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
         assertEquals("P",                   res.at("/query/operands/1/wrap/key").asText());
 
@@ -803,14 +803,14 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("operation:sequence",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:token",         res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("p",                   res.at("/query/operands/0/operands/0/operands/0/wrap/layer").asText());
         assertEquals("N",                   res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/1/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/1/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("V",                   res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
         assertEquals("P",                   res.at("/query/operands/1/wrap/key").asText());
 
@@ -819,10 +819,10 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("operation:relation",  res.at("/query/operation").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
         assertEquals("N",                   res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
         assertEquals("V",                   res.at("/query/operands/0/operands/0/operands/1/wrap/key").asText());
         assertEquals("P",                   res.at("/query/operands/1/wrap/key").asText());
@@ -832,20 +832,20 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("operation:sequence",  res.at("/query/operation").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(2,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(130,                     res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/classRef/0").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/operands/0/operands/0/classRef/0").asInt());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operands/0/operands/0/operation").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/classOut").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/classOut").asInt());
         assertEquals("NP",                  res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/operands/0/key").asText());
-        assertEquals(2,                     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(130,                     res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("V",                   res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
-        assertEquals(3,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+        assertEquals(131,                     res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
         assertEquals("P",                   res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
         assertEquals("operation:focus",     res.at("/query/operands/1/operation").asText());
-        assertEquals(3,                     res.at("/query/operands/1/classRef/0").asInt());
+        assertEquals(131,                     res.at("/query/operands/1/classRef/0").asInt());
         assertEquals(true,                  res.at("/query/operands/1/operands").isMissingNode());
     }
 
@@ -930,12 +930,12 @@
         assertEquals("operation:relation",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/operands/0/@type").asText());
         assertEquals("operation:class",     res.at("/query/operands/0/operands/0/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
         assertEquals("korap:span",          res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
         assertEquals(true,                  res.at("/query/operands/0/operands/0/operands/0/operands/0/key").isMissingNode());
         assertEquals("korap:span",          res.at("/query/operands/0/operands/0/operands/1/@type").asText());
@@ -952,7 +952,7 @@
         assertEquals("operation:relation",  res.at("/query/operation").asText());
         assertEquals("korap:reference",     res.at("/query/operands/0/@type").asText());
         assertEquals("operation:focus",     res.at("/query/operands/0/operation").asText());
-        assertEquals(1,                     res.at("/query/operands/0/classRef/0").asInt());
+        assertEquals(129,                     res.at("/query/operands/0/classRef/0").asInt());
         assertEquals("korap:group",         res.at("/query/operands/0/operands/0/@type").asText());
         assertEquals("operation:relation",  res.at("/query/operands/0/operands/0/operation").asText());
     }
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
index 04bd48c..8efd140 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
@@ -246,6 +246,13 @@
         res = mapper.readTree(qs.toJSON());
         assertEquals("korap:span", 			res.at("/query/@type").asText());
         assertEquals("s",					res.at("/query/key").asText());
+        
+        query = "<\".*\">";
+        qs.setQuery(query, "poliqarpplus");
+        res = mapper.readTree(qs.toJSON());
+        assertEquals("korap:span",          res.at("/query/@type").asText());
+        assertEquals(".*",                  res.at("/query/key").asText());
+        assertEquals("type:regex",          res.at("/query/type").asText());
 
         query = "<vp>";
         qs.setQuery(query, "poliqarpplus");
