binary search optimizations, part 1