[Numpy-discussion] Sorting refactor