Moved global code to QueryExecutor