Class reorganisation

Helper functions for query manipulation made "private" by extracting them from the class and putting them in the module.