Cleanup a little bit the code
Merge remote-tracking branch 'vtemian/more-pep8'
Add some error checks