Implements bisection method