smaller binary search function