improvements to query and test framework