Fixed bugs. Disabled randomized algorithm until another bug is fixed.