Adds documentation (both docstrings and some comments).
Updates readme.