Refactor QuerySorter & batch fetch