added randomized pivot and fixed some comments