Removed n+1 query and replaced with sort_by