added binary search functionality