diff --git a/aql/convertQuery.go b/aql/convertQuery.go
index d9c374ebfe78528a76b7692d5eb2e108b43a2485..e039b86392bcc3184b8a398c231ad88eca923b44 100644
--- a/aql/convertQuery.go
+++ b/aql/convertQuery.go
@@ -66,19 +66,19 @@ func createQuery(JSONQuery *entity.IncomingQueryJSON) *string {
 	for list := range listoflists {
 		for index := range listoflists[list] {
 			element := listoflists[list][index]
-			fmt.Println(element.typename)
-			switch element.typename {
+			fmt.Println(element.Typename)
+			switch element.Typename {
 			case "entity":
-				entity := JSONQuery.Entities[element.pointer]
+				entity := JSONQuery.Entities[element.Pointer]
 				query += entityToQuery(entity, JSONQuery)
 			case "relation":
-				relation := JSONQuery.Relations[element.pointer]
+				relation := JSONQuery.Relations[element.Pointer]
 				query += relationToQuery(relation, JSONQuery)
 			case "groupBy":
-				function := JSONQuery.GroupBys[element.pointer]
+				function := JSONQuery.GroupBys[element.Pointer]
 				query += functionToQuery(function, JSONQuery, list == len(listoflists)-1)
 			case "filter":
-				filter := JSONQuery.Filters[element.pointer]
+				filter := JSONQuery.Filters[element.Pointer]
 				query += filterToQuery(filter, JSONQuery)
 			}
 		}
diff --git a/aql/hierarchy.go b/aql/hierarchy.go
index 0fce792987387def8a184e082ca19d6bdcbf0c44..f61df5c66b159cb9b8a1b2cea8c6d1e165912780 100644
--- a/aql/hierarchy.go
+++ b/aql/hierarchy.go
@@ -7,14 +7,7 @@ import (
 	"git.science.uu.nl/graphpolaris/query-conversion/entity"
 )
 
-type pdict struct {
-	typename string
-	pointer  int
-}
-
-type pdictList []pdict
-
-var listoflists []pdictList
+var listoflists []entity.PdictList
 var reldone map[int]bool
 var entdone map[int]bool
 var funcdone map[int]bool
@@ -22,19 +15,19 @@ var relfuncdone map[int]bool
 var filterDone map[int]bool
 
 func search(JSONQuery *entity.IncomingQueryJSON, index int) {
-	listoflists = []pdictList{}
+	listoflists = []entity.PdictList{}
 	reldone = make(map[int]bool)
 	entdone = make(map[int]bool)
 	funcdone = make(map[int]bool)
 	relfuncdone = make(map[int]bool)
 	filterDone = make(map[int]bool)
-	var s pdictList
+	var s entity.PdictList
 	//printSlice(s)
 	//layercounter = 0
 
-	initent := pdict{
-		typename: "entity",
-		pointer:  index,
+	initent := entity.Pdict{
+		Typename: "entity",
+		Pointer:  index,
 	}
 
 	s = append(s, initent)
@@ -58,31 +51,31 @@ Entities always get added IN FRONT OF their respective relation in the hierarchy
 	JSONQuery: *entity.IncomingQueryJSON, the query in JSON format
 	rel: pdict, the relation to find all connected entities for
 */
-func relToEnt(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
-	var newlist pdictList
+func relToEnt(JSONQuery *entity.IncomingQueryJSON, rel entity.Pdict) {
+	var newlist entity.PdictList
 	layercounter := findCurrentLayer(listoflists, rel)
 	// Loop over all entities
 	// If an entity is already in the entdone dict we already added it to the hierarchy, so we don't have to add it again
 	// If an entity matches either the from or to in a relation we can add it to the newlist
 	for i := range JSONQuery.Entities {
 		if _, ok := entdone[i]; !ok {
-			if JSONQuery.Relations[rel.pointer].FromID == i && JSONQuery.Relations[rel.pointer].FromType == "entity" {
-				fromentity := pdict{
-					typename: "entity",
-					pointer:  i,
+			if JSONQuery.Relations[rel.Pointer].FromID == i && JSONQuery.Relations[rel.Pointer].FromType == "entity" {
+				fromentity := entity.Pdict{
+					Typename: "entity",
+					Pointer:  i,
 				}
 				newlist = append(newlist, fromentity)
-			} else if JSONQuery.Relations[rel.pointer].ToID == i && JSONQuery.Relations[rel.pointer].ToType == "entity" {
-				toentity := pdict{
-					typename: "entity",
-					pointer:  i,
+			} else if JSONQuery.Relations[rel.Pointer].ToID == i && JSONQuery.Relations[rel.Pointer].ToType == "entity" {
+				toentity := entity.Pdict{
+					Typename: "entity",
+					Pointer:  i,
 				}
 				newlist = append(newlist, toentity)
 			}
 		}
 	}
 	// This relation has found all its entities so we can set it's ID to true
-	reldone[rel.pointer] = true
+	reldone[rel.Pointer] = true
 	// If the newlist is empty, we can just skip the recursion
 	// This is effectively our base case
 	if len(newlist) != 0 {
@@ -94,7 +87,7 @@ func relToEnt(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
 		// After getting a list of entities we can only go towards a list of relation
 		// So we recurse by calling EntToRel
 		for i := range newlist {
-			fmt.Println("EntToRel being called with index?: " + strconv.Itoa(newlist[i].pointer))
+			fmt.Println("EntToRel being called with index?: " + strconv.Itoa(newlist[i].Pointer))
 			entToRel(JSONQuery, newlist[i])
 
 		}
@@ -108,31 +101,31 @@ Relation always get added BEHIND their respective entity in the hierarchy
 	JSONQuery: *entity.IncomingQueryJSON, the query in JSON format
 	ent: pdict, the entity to find all connected relations for
 */
-func entToRel(JSONQuery *entity.IncomingQueryJSON, ent pdict) {
-	var newlist pdictList
+func entToRel(JSONQuery *entity.IncomingQueryJSON, ent entity.Pdict) {
+	var newlist entity.PdictList
 	layercounter := findCurrentLayer(listoflists, ent)
 	// Loop over all relations
 	// If a relation is already in the reldone dict we already added it to the hierarchy, so we don't have to add it again
 	// If a relation matches either the from or to with the entity we can add it to the newlist
 	for i := range JSONQuery.Relations {
 		if _, ok := reldone[i]; !ok {
-			if JSONQuery.Relations[i].FromID == ent.pointer && JSONQuery.Relations[i].FromType == "entity" {
-				rel := pdict{
-					typename: "relation",
-					pointer:  i,
+			if JSONQuery.Relations[i].FromID == ent.Pointer && JSONQuery.Relations[i].FromType == "entity" {
+				rel := entity.Pdict{
+					Typename: "relation",
+					Pointer:  i,
 				}
 				newlist = append(newlist, rel)
-			} else if JSONQuery.Relations[i].ToID == ent.pointer && JSONQuery.Relations[i].ToType == "entity" {
-				rel := pdict{
-					typename: "relation",
-					pointer:  i,
+			} else if JSONQuery.Relations[i].ToID == ent.Pointer && JSONQuery.Relations[i].ToType == "entity" {
+				rel := entity.Pdict{
+					Typename: "relation",
+					Pointer:  i,
 				}
 				newlist = append(newlist, rel)
 			}
 		}
 	}
 	// This entity has found all its relations so we can set it's ID to true
-	entdone[ent.pointer] = true
+	entdone[ent.Pointer] = true
 
 	if len(newlist) != 0 {
 		// If our layercounter is equal to the length of the hierarchy - 1 we are in the last "layer" of the hierarchy
@@ -144,9 +137,9 @@ func entToRel(JSONQuery *entity.IncomingQueryJSON, ent pdict) {
 		// After getting a list of relations we can only go towards a list of entities or a list of functions
 		// So we recurse by calling RelToEnt and RelToAllFunc
 		for i := range newlist {
-			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(newlist[i].pointer))
+			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(newlist[i].Pointer))
 			relToEnt(JSONQuery, newlist[i])
-			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(newlist[i].pointer))
+			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(newlist[i].Pointer))
 			relToAllFunc(JSONQuery, newlist[i])
 
 		}
@@ -161,9 +154,9 @@ If a function is connected to a relation (relation uses the results from the fun
 	JSONQuery: *entity.IncomingQueryJSON, the query in JSON format
 	rel: pdict, the relation to find all connected functions for
 */
-func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
-	var funcappliedtosubquery pdictList
-	var functowhichrelapplies pdictList
+func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel entity.Pdict) {
+	var funcappliedtosubquery entity.PdictList
+	var functowhichrelapplies entity.PdictList
 	layercounter := findCurrentLayer(listoflists, rel)
 	// Loop over all functions
 	// If a relation is already in the relfuncdone dict we already added it to the hierarchy, so we don't have to add it again
@@ -171,29 +164,29 @@ func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
 	// If the relation's functionpointer matches a function's ID then the relation is connected to the function
 	// Depending on the case they get put in a different list and are put in different places in the hierarchy
 	for i := range JSONQuery.GroupBys {
-		if _, ok := relfuncdone[rel.pointer]; !ok {
+		if _, ok := relfuncdone[rel.Pointer]; !ok {
 			if _, ok := funcdone[i]; !ok {
-				if JSONQuery.GroupBys[i].RelationID == rel.pointer {
-					relfunc := pdict{
-						typename: "groupBy",
-						pointer:  i,
+				if JSONQuery.GroupBys[i].RelationID == rel.Pointer {
+					relfunc := entity.Pdict{
+						Typename: "groupBy",
+						Pointer:  i,
 					}
 					funcappliedtosubquery = append(funcappliedtosubquery, relfunc)
 					fmt.Println("I AM HERE 1")
 				}
 
-				if JSONQuery.Relations[rel.pointer].FromID == i && JSONQuery.Relations[rel.pointer].FromType == "groupBy" {
-					fromfunc := pdict{
-						typename: "groupBy",
-						pointer:  i,
+				if JSONQuery.Relations[rel.Pointer].FromID == i && JSONQuery.Relations[rel.Pointer].FromType == "groupBy" {
+					fromfunc := entity.Pdict{
+						Typename: "groupBy",
+						Pointer:  i,
 					}
 					functowhichrelapplies = append(functowhichrelapplies, fromfunc)
 					fmt.Println("I AM HERE 2")
 
-				} else if JSONQuery.Relations[rel.pointer].ToID == i && JSONQuery.Relations[rel.pointer].ToType == "groupBy" {
-					tofunc := pdict{
-						typename: "groupBy",
-						pointer:  i,
+				} else if JSONQuery.Relations[rel.Pointer].ToID == i && JSONQuery.Relations[rel.Pointer].ToType == "groupBy" {
+					tofunc := entity.Pdict{
+						Typename: "groupBy",
+						Pointer:  i,
 					}
 					functowhichrelapplies = append(functowhichrelapplies, tofunc)
 					fmt.Println("I AM HERE 3")
@@ -204,7 +197,7 @@ func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
 		}
 
 	}
-	relfuncdone[rel.pointer] = true
+	relfuncdone[rel.Pointer] = true
 	layercountertwo := layercounter
 	layercounterthree := layercounter
 	// See main function comment to see which sublist gets put where in the hierarchy
@@ -212,7 +205,7 @@ func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
 		listoflists = aboveAppend(listoflists, layercountertwo, functowhichrelapplies)
 
 		for i := range functowhichrelapplies {
-			fmt.Println("FuncToAllRell being called with index?: " + strconv.Itoa(functowhichrelapplies[i].pointer))
+			fmt.Println("FuncToAllRell being called with index?: " + strconv.Itoa(functowhichrelapplies[i].Pointer))
 			funcToAllRel(JSONQuery, functowhichrelapplies[i])
 
 		}
@@ -223,7 +216,7 @@ func relToAllFunc(JSONQuery *entity.IncomingQueryJSON, rel pdict) {
 		listoflists = belowAppend(listoflists, layercounterthree, funcappliedtosubquery)
 
 		for i := range funcappliedtosubquery {
-			fmt.Println("FuncToAllRel being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].pointer))
+			fmt.Println("FuncToAllRel being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].Pointer))
 			funcToAllRel(JSONQuery, funcappliedtosubquery[i])
 		}
 	}
@@ -238,34 +231,34 @@ If a relation is connected to a function, we add the relation BEHIND its respect
 	JSONQuery: *entity.IncomingQueryJSON, the query in JSON format
 	function: pdict, the function to find all connected relations for
 */
-func funcToAllRel(JSONQuery *entity.IncomingQueryJSON, function pdict) {
-	var funcappliedtosubquery pdictList
-	var relattachedtofunc pdictList
+func funcToAllRel(JSONQuery *entity.IncomingQueryJSON, function entity.Pdict) {
+	var funcappliedtosubquery entity.PdictList
+	var relattachedtofunc entity.PdictList
 	layercounter := findCurrentLayer(listoflists, function)
 	for i := range JSONQuery.Relations {
-		if _, ok := funcdone[function.pointer]; !ok {
+		if _, ok := funcdone[function.Pointer]; !ok {
 			if _, ok := relfuncdone[i]; !ok {
 				// The func is attached to this relation
-				if JSONQuery.GroupBys[function.pointer].RelationID == i {
-					funcrel := pdict{
-						typename: "relation",
-						pointer:  i,
+				if JSONQuery.GroupBys[function.Pointer].RelationID == i {
+					funcrel := entity.Pdict{
+						Typename: "relation",
+						Pointer:  i,
 					}
 					funcappliedtosubquery = append(funcappliedtosubquery, funcrel)
 
 				}
 
-				if JSONQuery.Relations[i].FromID == function.pointer && JSONQuery.Relations[i].FromType == "groupBy" {
-					fromrel := pdict{
-						typename: "relation",
-						pointer:  i,
+				if JSONQuery.Relations[i].FromID == function.Pointer && JSONQuery.Relations[i].FromType == "groupBy" {
+					fromrel := entity.Pdict{
+						Typename: "relation",
+						Pointer:  i,
 					}
 					relattachedtofunc = append(relattachedtofunc, fromrel)
 
-				} else if JSONQuery.Relations[i].ToID == function.pointer && JSONQuery.Relations[i].ToType == "groupBy" {
-					torel := pdict{
-						typename: "relation",
-						pointer:  i,
+				} else if JSONQuery.Relations[i].ToID == function.Pointer && JSONQuery.Relations[i].ToType == "groupBy" {
+					torel := entity.Pdict{
+						Typename: "relation",
+						Pointer:  i,
 					}
 					relattachedtofunc = append(relattachedtofunc, torel)
 
@@ -274,7 +267,7 @@ func funcToAllRel(JSONQuery *entity.IncomingQueryJSON, function pdict) {
 			}
 		}
 	}
-	funcdone[function.pointer] = true
+	funcdone[function.Pointer] = true
 
 	layercountertwo := layercounter
 	layercounterthree := layercounter
@@ -283,9 +276,9 @@ func funcToAllRel(JSONQuery *entity.IncomingQueryJSON, function pdict) {
 		listoflists = aboveAppend(listoflists, layercountertwo, funcappliedtosubquery)
 
 		for i := range funcappliedtosubquery {
-			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].pointer))
+			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].Pointer))
 			relToEnt(JSONQuery, funcappliedtosubquery[i])
-			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].pointer))
+			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(funcappliedtosubquery[i].Pointer))
 			relToAllFunc(JSONQuery, funcappliedtosubquery[i])
 
 		}
@@ -295,9 +288,9 @@ func funcToAllRel(JSONQuery *entity.IncomingQueryJSON, function pdict) {
 		listoflists = belowAppend(listoflists, layercounterthree, relattachedtofunc)
 
 		for i := range relattachedtofunc {
-			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(relattachedtofunc[i].pointer))
+			fmt.Println("RelToEnt being called with index?: " + strconv.Itoa(relattachedtofunc[i].Pointer))
 			relToEnt(JSONQuery, relattachedtofunc[i])
-			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(relattachedtofunc[i].pointer))
+			fmt.Println("RelToAllFunc being called with index?: " + strconv.Itoa(relattachedtofunc[i].Pointer))
 			relToAllFunc(JSONQuery, relattachedtofunc[i])
 		}
 	}
@@ -307,57 +300,57 @@ func addFilters(JSONQuery *entity.IncomingQueryJSON) {
 
 	for i, filter := range JSONQuery.Filters {
 		if _, ok := filterDone[i]; !ok {
-			p := pdict{
-				typename: filter.FromType,
-				pointer:  filter.FromID,
+			p := entity.Pdict{
+				Typename: filter.FromType,
+				Pointer:  filter.FromID,
 			}
-			f := pdict{
-				typename: "filter",
-				pointer:  filter.ID,
+			f := entity.Pdict{
+				Typename: "filter",
+				Pointer:  filter.ID,
 			}
 			addOneFilter(f, JSONQuery, p, &filterDone)
 		}
 	}
 }
 
-func addOneFilter(filterPDict pdict, JSONQuery *entity.IncomingQueryJSON, p pdict, filterDone *map[int]bool) {
-	if p.typename == "filter" && (*filterDone)[p.pointer] {
+func addOneFilter(filterPDict entity.Pdict, JSONQuery *entity.IncomingQueryJSON, p entity.Pdict, filterDone *map[int]bool) {
+	if p.Typename == "filter" && (*filterDone)[p.Pointer] {
 		l := findCurrentLayer(listoflists, p)
-		k := pdictList{filterPDict}
-		if len(listoflists) > l+1 && listoflists[l+1][0].typename == "filter" {
+		k := entity.PdictList{filterPDict}
+		if len(listoflists) > l+1 && listoflists[l+1][0].Typename == "filter" {
 			listoflists[l+1] = append(listoflists[l+1], filterPDict)
 		} else {
 			listoflists = filterAppend(listoflists, l, k)
 		}
-		(*filterDone)[filterPDict.pointer] = true
-	} else if p.typename == "filter" {
-		pnew := pdict{
-			typename: JSONQuery.Filters[p.pointer].FromType,
-			pointer:  JSONQuery.Filters[p.pointer].FromID,
+		(*filterDone)[filterPDict.Pointer] = true
+	} else if p.Typename == "filter" {
+		pnew := entity.Pdict{
+			Typename: JSONQuery.Filters[p.Pointer].FromType,
+			Pointer:  JSONQuery.Filters[p.Pointer].FromID,
 		}
 		addOneFilter(p, JSONQuery, pnew, filterDone)
 		l := findCurrentLayer(listoflists, p)
-		k := pdictList{filterPDict}
-		if len(listoflists) > l+1 && listoflists[l+1][0].typename == "filter" {
+		k := entity.PdictList{filterPDict}
+		if len(listoflists) > l+1 && listoflists[l+1][0].Typename == "filter" {
 			listoflists[l+1] = append(listoflists[l+1], filterPDict)
 		} else {
 			listoflists = filterAppend(listoflists, l, k)
 		}
-		(*filterDone)[filterPDict.pointer] = true
+		(*filterDone)[filterPDict.Pointer] = true
 	} else {
 		l := findCurrentLayer(listoflists, p)
-		k := pdictList{filterPDict}
-		if len(listoflists) > l+1 && listoflists[l+1][0].typename == "filter" {
+		k := entity.PdictList{filterPDict}
+		if len(listoflists) > l+1 && listoflists[l+1][0].Typename == "filter" {
 			listoflists[l+1] = append(listoflists[l+1], filterPDict)
 		} else {
 			listoflists = filterAppend(listoflists, l, k)
 		}
-		(*filterDone)[filterPDict.pointer] = true
+		(*filterDone)[filterPDict.Pointer] = true
 	}
 }
 
 // A function that appends 1 level above (if index is 0 this won't work)
-func aboveAppend(lists []pdictList, index int, values pdictList) []pdictList {
+func aboveAppend(lists []entity.PdictList, index int, values entity.PdictList) []entity.PdictList {
 	if index == 0 {
 		return prepend(lists, values)
 	} else {
@@ -371,7 +364,7 @@ func aboveAppend(lists []pdictList, index int, values pdictList) []pdictList {
 }
 
 // A function that appends 1 level below
-func belowAppend(lists []pdictList, index int, values pdictList) []pdictList {
+func belowAppend(lists []entity.PdictList, index int, values entity.PdictList) []entity.PdictList {
 	if index == len(listoflists)-1 {
 		lists = append(listoflists, values)
 		return lists
@@ -386,13 +379,13 @@ func belowAppend(lists []pdictList, index int, values pdictList) []pdictList {
 	}
 }
 
-func filterAppend(lists []pdictList, index int, values pdictList) []pdictList {
+func filterAppend(lists []entity.PdictList, index int, values entity.PdictList) []entity.PdictList {
 	if len(lists)-1 == index { // nil or empty slice or after last element
 		return append(lists, values)
 	}
-	k := make([]pdictList, len(lists[index+1:]))
+	k := make([]entity.PdictList, len(lists[index+1:]))
 	copy(k, lists[index+1:])
-	l := make([]pdictList, len(lists[:index+1]))
+	l := make([]entity.PdictList, len(lists[:index+1]))
 	copy(l, lists[:index+1])
 	lists = append(l, values) // index < len(a)
 	return append(lists, k...)
@@ -401,11 +394,11 @@ func filterAppend(lists []pdictList, index int, values pdictList) []pdictList {
 
 // A simple double-for loop that finds the layer in which an element resides in the hierarchy
 // Because we only append elements relative to another element, we can freely use this to keep track of layers
-func findCurrentLayer(list []pdictList, element pdict) int {
+func findCurrentLayer(list []entity.PdictList, element entity.Pdict) int {
 	currlayer := -1
 	for i, sublist := range list {
 		for j := range sublist {
-			if sublist[j].pointer == element.pointer && sublist[j].typename == element.typename {
+			if sublist[j].Pointer == element.Pointer && sublist[j].Typename == element.Typename {
 				currlayer = i
 				//break
 			}
@@ -418,11 +411,11 @@ func findCurrentLayer(list []pdictList, element pdict) int {
 // Only needed when a entire new list has to be inserted in front of the hierarcy
 // Prepending to existing layers can be done by decreasing the layercounter and appending
 // See XToY functions for example usage
-func prepend(list []pdictList, element pdictList) []pdictList {
-	var dummylist pdictList
-	dummy := pdict{
-		typename: "dummy",
-		pointer:  -1,
+func prepend(list []entity.PdictList, element entity.PdictList) []entity.PdictList {
+	var dummylist entity.PdictList
+	dummy := entity.Pdict{
+		Typename: "dummy",
+		Pointer:  -1,
 	}
 	dummylist = append(dummylist, dummy)
 	list = append(list, dummylist)
diff --git a/aql/hierarchy_test.go b/aql/hierarchy_test.go
index f743ca85d1699178b3432b7b8b014c781dc6c6e1..c65190e559450790b97ad94fb709339227ea66c9 100644
--- a/aql/hierarchy_test.go
+++ b/aql/hierarchy_test.go
@@ -166,17 +166,17 @@ func TestHierarchyRandomStart(t *testing.T) {
 	// Unmarshall the incoming message into an IncomingJSONQuery object
 	var JSONQuery entity.IncomingQueryJSON
 	json.Unmarshal(query, &JSONQuery)
-	correctResult := make([]pdictList, 4)
-	correctResult[0] = pdictList{{typename: "entity", pointer: 0}, {typename: "entity", pointer: 1}}
-	correctResult[1] = pdictList{{typename: "filter", pointer: 0}}
-	correctResult[2] = pdictList{{typename: "relation", pointer: 0}}
-	correctResult[3] = pdictList{{typename: "filter", pointer: 1}}
+	correctResult := make([]entity.PdictList, 4)
+	correctResult[0] = entity.PdictList{{Typename: "entity", Pointer: 0}, {Typename: "entity", Pointer: 1}}
+	correctResult[1] = entity.PdictList{{Typename: "filter", Pointer: 0}}
+	correctResult[2] = entity.PdictList{{Typename: "relation", Pointer: 0}}
+	correctResult[3] = entity.PdictList{{Typename: "filter", Pointer: 1}}
 
 	for i := range JSONQuery.Entities {
 		search(&JSONQuery, i)
-		sortedListOfLists := make([]pdictList, len(listoflists))
+		sortedListOfLists := make([]entity.PdictList, len(listoflists))
 		for i, list := range listoflists {
-			k := make(pdictList, list.Len())
+			k := make(entity.PdictList, list.Len())
 			copy(k, list)
 			sort.Sort(k)
 			sortedListOfLists[i] = k
@@ -308,20 +308,20 @@ func TestHierarchyWithGroupby(t *testing.T) {
 	// Unmarshall the incoming message into an IncomingJSONQuery object
 	var JSONQuery entity.IncomingQueryJSON
 	json.Unmarshal(query, &JSONQuery)
-	correctResult := make([]pdictList, 5)
-	correctResult[0] = pdictList{{typename: "entity", pointer: 0}, {typename: "entity", pointer: 1}}
-	correctResult[1] = pdictList{{typename: "relation", pointer: 0}}
-	correctResult[2] = pdictList{{typename: "entity", pointer: 2}, {typename: "entity", pointer: 3}, {typename: "groupBy", pointer: 0}}
-	correctResult[3] = pdictList{{typename: "filter", pointer: 0}}
-	correctResult[4] = pdictList{{typename: "relation", pointer: 1}, {typename: "relation", pointer: 2}}
+	correctResult := make([]entity.PdictList, 5)
+	correctResult[0] = entity.PdictList{{Typename: "entity", Pointer: 0}, {Typename: "entity", Pointer: 1}}
+	correctResult[1] = entity.PdictList{{Typename: "relation", Pointer: 0}}
+	correctResult[2] = entity.PdictList{{Typename: "entity", Pointer: 2}, {Typename: "entity", Pointer: 3}, {Typename: "groupBy", Pointer: 0}}
+	correctResult[3] = entity.PdictList{{Typename: "filter", Pointer: 0}}
+	correctResult[4] = entity.PdictList{{Typename: "relation", Pointer: 1}, {Typename: "relation", Pointer: 2}}
 
 	for i := range JSONQuery.Entities {
 		search(&JSONQuery, i)
 
 		fmt.Println(listoflists)
-		sortedListOfLists := make([]pdictList, len(listoflists))
+		sortedListOfLists := make([]entity.PdictList, len(listoflists))
 		for i, list := range listoflists {
-			k := make(pdictList, list.Len())
+			k := make(entity.PdictList, list.Len())
 			copy(k, list)
 			sort.Sort(k)
 			sortedListOfLists[i] = k