Updated Quicksort with accounting for duplicates