Better error handling
Pep8-ized