Binary search implementation