diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
index 327f585..489a00d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
@@ -345,9 +345,9 @@
 			if (leftChildSpec != null) relation.put("index", 0);
 			if (rightChildSpec != null) relation.put("index", -1);
 			if (qName != null) relation.putAll(parseQNameNode(qName));
-			if (edgeSpec != null) relation.put("edges", parseEdgeSpec(edgeSpec)) ;
-			if (star != null) relation.put("boundary", makeBoundary(0, 100));
-			if (rangeSpec != null) relation.put("boundary", parseRangeSpec(rangeSpec));
+			if (edgeSpec != null) relation.put("wrap", parseEdgeSpec(edgeSpec)) ;
+			if (star != null) relation.put("distance", makeDistance("r", 0, 100));
+			if (rangeSpec != null) relation.put("distance", distanceFromRangeSpec("r", rangeSpec));
 			
 		}
 		else if (operator.equals("pointing")) {
@@ -358,10 +358,11 @@
 			ParseTree edgeSpec = getFirstChildWithCat(operatorNode, "edgeSpec");
 			ParseTree star = getFirstChildWithCat(operatorNode, "*");
 			ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
-			if (qName != null) relation.putAll(parseQNameNode(qName));
-			if (edgeSpec != null) relation.put("edges", parseEdgeSpec(edgeSpec)) ;
-			if (star != null) relation.put("boundary", makeBoundary(0, 100));
-			if (rangeSpec != null) relation.put("boundary", parseRangeSpec(rangeSpec));
+//			if (qName != null) relation.putAll(parseQNameNode(qName));
+			if (qName != null) relation.put("reltype", qName.getText());
+			if (edgeSpec != null) relation.put("wrap", parseEdgeSpec(edgeSpec)) ;
+			if (star != null) relation.put("distance", makeDistance("r", 0, 100));
+			if (rangeSpec != null) relation.put("distance", distanceFromRangeSpec("r", rangeSpec));
 			
 		}
 		else if (operator.equals("precedence")) {
@@ -412,23 +413,31 @@
 	private LinkedHashMap<String, Object> parseEdgeAnno(
 			ParseTree edgeAnnoSpec) {
 		LinkedHashMap<String, Object> edgeAnno = new LinkedHashMap<String, Object>();
-		edgeAnno.put("@type", "korap:edge");
+		edgeAnno.put("@type", "korap:term");
 		ParseTree labelNode = edgeAnnoSpec.getChild(0);
 		ParseTree matchOperatorNode = edgeAnnoSpec.getChild(1);
 		ParseTree textSpecNode = edgeAnnoSpec.getChild(2);
-		edgeAnno.put("label", labelNode.getChild(0).toStringTree(parser));
+		edgeAnno.put("layer", labelNode.getChild(0).toStringTree(parser));
 		edgeAnno.putAll(parseTextSpec(textSpecNode));
 		edgeAnno.put("match", parseMatchOperator(matchOperatorNode));
 		return edgeAnno;
 	}
 
-	private LinkedHashMap<String, Object> parseRangeSpec(ParseTree rangeSpec) {
+	private LinkedHashMap<String, Object> boundaryFromRangeSpec(ParseTree rangeSpec) {
 		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
 		Integer max = MAXIMUM_DISTANCE;
 		if (rangeSpec.getChildCount()==3) 
 			max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
 		return makeBoundary(min, max);
 	}
+
+	private LinkedHashMap<String, Object> distanceFromRangeSpec(String key, ParseTree rangeSpec) {
+		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
+		Integer max = MAXIMUM_DISTANCE;
+		if (rangeSpec.getChildCount()==3) 
+			max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
+		return makeDistance(key, min, max);
+	}
 	
 	private LinkedHashMap<String, Object> parseDistance(ParseTree rangeSpec) {
 		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
diff --git a/src/test/java/AqlTreeTest.java b/src/test/java/AqlTreeTest.java
index 922ca27..15a5c0b 100644
--- a/src/test/java/AqlTreeTest.java
+++ b/src/test/java/AqlTreeTest.java
@@ -106,7 +106,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
-				"], relation={@type=korap:treeRelation, reltype=dominance, edges=[{@type=korap:edge, label=cat, key=NP, match=match:eq}]}" +
+				"], relation={@type=korap:treeRelation, reltype=dominance, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -117,7 +117,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
-				"], relation={@type=korap:treeRelation, reltype=dominance, index=0, edges=[{@type=korap:edge, label=cat, key=NP, match=match:eq}]}" +
+				"], relation={@type=korap:treeRelation, reltype=dominance, index=0, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -129,7 +129,7 @@
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
 				"], relation={@type=korap:treeRelation, reltype=dominance, " +
-						"boundary={@type=korap:boundary, min=2, max=4}}" +
+						"distance={@type=korap:distance, key=r, min=2, max=4}}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -143,7 +143,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:span}" +
-				"], relation={@type=korap:relation, layer=coref, label=label, key=true}" +
+				"], relation={@type=korap:relation, reltype=label, wrap=[{@type=korap:term, layer=coref, key=true, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
