Separate function to create QueryExecutor