Little improvment for sorting algorithm