new sort logic begun