diff --git a/go.mod b/go.mod
index 8046f082ba2a4ac426d4725c1463fe67283190f1..4332e9160c407b09c0e126934937275447cc7d51 100644
--- a/go.mod
+++ b/go.mod
@@ -5,12 +5,12 @@ go 1.15
 require (
 	git.science.uu.nl/datastrophe/broker v0.0.0-20210516094125-abbeaf96fd58
 	git.science.uu.nl/datastrophe/keyvaluestore v0.0.0-20210517170603-34902cd5c90d
-	git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210517164802-5852eee71ec0
-	github.com/arangodb/go-driver v0.0.0-20210506071742-64f314d85db7
+	git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093948-06ff65cdf577
+	github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90
 	github.com/stretchr/testify v1.7.0
 	github.com/thijsheijden/alice v0.1.18
-	golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
+	golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
 	golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
-	google.golang.org/grpc v1.37.0
+	google.golang.org/grpc v1.37.1
 	google.golang.org/protobuf v1.26.0
 )
diff --git a/go.sum b/go.sum
index 8685c26d1b1be88c1e1f46e6a0cd6a475bee8f85..d3c5b11d676dbebaa6b1c0708682a26b8b75c8eb 100644
--- a/go.sum
+++ b/go.sum
@@ -5,9 +5,17 @@ git.science.uu.nl/datastrophe/keyvaluestore v0.0.0-20210517170603-34902cd5c90d h
 git.science.uu.nl/datastrophe/keyvaluestore v0.0.0-20210517170603-34902cd5c90d/go.mod h1:8fw3mDyMATpBNUhd3T1Me0FvYRGIYtyRgP6Q4EyBUgE=
 git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210517164802-5852eee71ec0 h1:UrYqOFjIFxaHtmzqsoId48g/jPEdGX4MCX5sDjbzBSI=
 git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210517164802-5852eee71ec0/go.mod h1:6rvalwekoukmVu3SbWmZkj8wBZEm34wDbA4Ilxcb+jw=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093004-75fc1e21873b h1:vWLwHNHlO6BK/G789PivzPfl/nj+2uGvGQO0OAl4kLU=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093004-75fc1e21873b/go.mod h1:6rvalwekoukmVu3SbWmZkj8wBZEm34wDbA4Ilxcb+jw=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093728-9ee791a5281e h1:s17YnYuEDEnVZ43r0XfFfIP6zYoBtLhFbdCQvXFJI88=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093728-9ee791a5281e/go.mod h1:6rvalwekoukmVu3SbWmZkj8wBZEm34wDbA4Ilxcb+jw=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093948-06ff65cdf577 h1:Xd9hpnnRhYWdAXzLFviA6fYWnQoFD/4NtzmEC7Ntc/U=
+git.science.uu.nl/datastrophe/query-conversion v0.0.0-20210518093948-06ff65cdf577/go.mod h1:6rvalwekoukmVu3SbWmZkj8wBZEm34wDbA4Ilxcb+jw=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/arangodb/go-driver v0.0.0-20210506071742-64f314d85db7 h1:xRFEg4kM17h2fIOt3o4+mws3uRpw5rqWtemPYKfTURg=
 github.com/arangodb/go-driver v0.0.0-20210506071742-64f314d85db7/go.mod h1:3NUekcRLpgheFIGEwcOvxilEW73MV1queNKW58k7sdc=
+github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90 h1:NMnMsS32jOF+e0v+MLXlgRJM7ejSAXxHg1UDv1q417I=
+github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90/go.mod h1:3NUekcRLpgheFIGEwcOvxilEW73MV1queNKW58k7sdc=
 github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e h1:Xg+hGrY2LcQBbxd0ZFdbGSyRKTYMZCfBbw/pMJFOk1g=
 github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e/go.mod h1:mq7Shfa/CaixoDxiyAAc5jZ6CVBAyPaNQCGS7mkj4Ho=
 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -76,6 +84,7 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
 github.com/rs/zerolog v1.19.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
 github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=
 github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
+github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
@@ -113,6 +122,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
 golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
 golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I=
+golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -132,12 +143,15 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
 golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
@@ -164,6 +178,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
 google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c=
 google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.37.1 h1:ARnQJNWxGyYJpdf/JXscNlQr/uv607ZPU9Z7ogHi+iI=
+google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
diff --git a/internal/entity/JSONQuery.go b/internal/entity/JSONQuery.go
deleted file mode 100644
index ec04a6e7e28e15a806060d4ab5cabf54def159f2..0000000000000000000000000000000000000000
--- a/internal/entity/JSONQuery.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package entity
-
-// IncomingQueryJSON describes the query coming into the service in JSON format
-type IncomingQueryJSON struct {
-	DatabaseName string
-	Return       QueryReturnStruct
-	Entities     []QueryEntityStruct
-	Relations    []QueryRelationStruct
-	// Limit is for limiting the amount of paths AQL will return in a relation let statement
-	Limit     int
-	Modifiers []QueryModifierStruct
-}
-
-// QueryReturnStruct holds the indices of the entities and relations that need to be returned
-type QueryReturnStruct struct {
-	Entities  []int
-	Relations []int
-	//Modifiers []int
-}
-
-// QueryEntityStruct encapsulates a single entity with its corresponding constraints
-type QueryEntityStruct struct {
-	Type        string
-	Constraints []QueryConstraintStruct
-}
-
-// QueryRelationStruct encapsulates a single relation with its corresponding constraints
-type QueryRelationStruct struct {
-	Type        string
-	EntityFrom  int
-	EntityTo    int
-	Depth       QuerySearchDepthStruct
-	Constraints []QueryConstraintStruct
-}
-
-// QueryModifierStruct encapsulates a single modifier with its corresponding constraints
-type QueryModifierStruct struct {
-	Type           string // SUM COUNT AVG
-	SelectedType   string // node relation
-	ID             int    // ID of the enitity or relation
-	AttributeIndex int    // = -1 if its the node or relation, = > -1 if an attribute is selected
-}
-
-// QuerySearchDepthStruct holds the range of traversals for the relation
-type QuerySearchDepthStruct struct {
-	Min int
-	Max int
-}
-
-// QueryConstraintStruct holds the information of the constraint
-// Constraint datatypes
-// 	text     MatchTypes: exact/contains/startswith/endswith
-// 	number   MatchTypes: GT/LT/EQ
-// 	bool     MatchTypes: EQ/NEQ
-type QueryConstraintStruct struct {
-	Attribute string
-	Value     string
-	DataType  string
-	MatchType string
-}
diff --git a/internal/usecases/consume/handlemessage.go b/internal/usecases/consume/handlemessage.go
index b114f00d843fbde002aeb9a228b7e67ff5b4d488..44bd65492361622c8dd3212e3f7ba6a0ffc7b3a7 100644
--- a/internal/usecases/consume/handlemessage.go
+++ b/internal/usecases/consume/handlemessage.go
@@ -7,6 +7,7 @@ import (
 	"strings"
 
 	"git.science.uu.nl/datastrophe/broker"
+	"git.science.uu.nl/datastrophe/query-conversion"
 )
 
 // HandleMessage gets called when a message is received
@@ -22,9 +23,8 @@ func (s *Service) HandleMessage(msg *broker.Message) {
 		return
 	}
 
-	// Marshall the incoming message into an IncomingJSONQuery object
-	var JSONQuery entity.IncomingQueryJSON
-	err := json.Unmarshal(msg.Body, &JSONQuery)
+	// Unmarshall the incoming message into an IncomingJSONQuery object
+	JSONQuery, err := query.UnmarshalJSON(&msg.Body)
 	if err != nil {
 		errorMsg := entity.MessageStruct{
 			Type:  "query_translation_error",
@@ -36,7 +36,7 @@ func (s *Service) HandleMessage(msg *broker.Message) {
 	}
 
 	// Convert the json byte msg to a query string
-	query, databaseName, err := s.queryConverter.ConvertQuery(&msg.Body)
+	query, err := s.queryConverter.ConvertQuery(JSONQuery)
 	if err != nil {
 		errorMsg := entity.MessageStruct{
 			Type:  "query_translation_error",
@@ -48,7 +48,7 @@ func (s *Service) HandleMessage(msg *broker.Message) {
 	}
 
 	// Check if there was a database name
-	if *databaseName == "" {
+	if JSONQuery.DatabaseName == "" {
 		errorMsg := entity.MessageStruct{
 			Type:  "query_malformed_request_error",
 			Value: "no database name supplied",
@@ -76,7 +76,7 @@ func (s *Service) HandleMessage(msg *broker.Message) {
 	s.producer.PublishMessage(&translationMsgBytes, &sessionID) // TODO: should this be a go routine?
 
 	// Fetch database credentials from the user service
-	databaseInfo, err := s.databaseInfoService.GetDatabaseInfo(&clientID, databaseName)
+	databaseInfo, err := s.databaseInfoService.GetDatabaseInfo(&clientID, &JSONQuery.DatabaseName)
 	if err != nil {
 		errorMsg := entity.MessageStruct{
 			Type:  "query_database_not_found",