Query executor refactored