updated binary search