updated pep8 conformance, some refractoring