Cleans up the query a bit more