class that executes queries