Refactored code for PEP-8 compliance