Working bisection algorithm (slow)
Some more hacking on the bisection alg