Some PEP8 tweaks and more input error handling.