Simplifying stack sorter