Code cleanup based on pylint results and pep8

pylint --disable=C0111,C0103,W0703,R0801 bugsnag