respect  linewidth
some docstring/doctest cleanup and resulting code changes