QuickSort Madian selection refactored