Clean up queries.