Add docstrings to every function. And a few other comments.
Use proper Sphinx param syntax