A binary search implementation