Updated median of 3 partitioning -- needs to be fixed