Second method for qsort