Better error handling and reporting, pep8