Revised code to comply with PEP8