Using doctest sphinx extension. Some documentation rewriting.