update sorter logic