cleaning up queries