Formatting fixes to code and docstrings