Re-added Barry's binary search function!