Improve bisection
Use bisect module for bisection