Make query faster and order properly