Refactored
Verified with Pep8