Refactored code to PEP 8