write the binary search for slicing so that slicing can be faster