some changes in binary search