improve bsearch structure