Refactor to make it more PEP8