Some minor adjustments to the binary search.