Slightly improved binarySearch in index by simplifying the search algo
and splitting it up