Working BinarySearch code