Moved QueryContext to Scala