added protection to binary search algorithm in the case where client is naughty, i.e. where they don't let the algo converge by returning incorrect "too high" and "too low" flags