Some refinement of std-sort