Edited binarySearch but is faulty