added binary search improvment