Give main a better name.
Fix pep8 errors and more.

In addition to pep8, fix a is None check and
add some new debug info.