Handles empty queries