Fixed repeatedly printing docs. Tidied up code.
Improved interface.