Replaced bsearch with BinarySearch.