another silly attempt at binary search