Modify function binary search