finish first version of binary search dispatch