add binary_search_index

In response to #15, should address the contention therein. Also a bit of a rewrite so that the code is a bit more idiomatic.