cleaned query before sending to view