Style refactor

Minor refactor to help comply with the Python coding standards and
improve readability. More to come later. Special thanks to Stephen
Kleene and Ken Thompson.