added looping binary search