More pylint fixes, code style fixes and fix some errors made visible by pylint.