Add license header and docstrings, fix typo