simplify binary search routine