a more intuitive bsearch