First wave of refactoring (modularization)
Fix typo
Some code style fixes (pep8)