added binary search code