implement binarysearchwindow