added some comments and formatting, also autodoc