added function for binary search and similar algorithms

also, start writing unit tests again. For the non-visual parts,
unit tests totally make sense.