Formatting, minor refactoring, and doc tweaks - autopep8 -i -a -a