Clean up queries