changed the binary search to use recursion