Refactored code to become PEP8 compliant