Reorganisation, including introduction of use of doctest