Further refactoring, PEP8 compliance