Reorganized quicksort code using new partition func