Implemented binarySearch