hacky recursive binary search