Adds query context structure
Refactors query data structure, decouples from context
Handle bags of temp keys