multiple optimizations for QuickSort

thorough tests and updates