add function pointer for binary search