fixed pivotVal overwrite bug in quickPartition(), cleaned up code