PEP8 compliance, refactoring and main check