Clean and optimized results of the query