PEP8 and readability improvements