Clean up of QueryContext
Merge pull request #1121 from systay/querycontext-cleanup

Clean up of QueryContext