Clean up Query.