done! could be improved by picking random pivot though