applyIteratorSortBy improved