Improve separation of queries and execution