Sorter logic improvements.