Fixed the Bugs while making the code PEP8 compliant