clean up query