Refine the code of sorter to adapt for any type extends Comparable