change the partition algorithm - still debugging