initial implementation
use one bsearch with function parameters