Tidy up comments, provide some docstrings