Some work on the query classes and testing