Added nested qsort alternative