Refactored code to be PEP8 compliant