implemented "binary search" algorithm