Changes improving structure of the source code and making code compliant with PEP8