binary search almost complete