Made some more changes and added lots of comments to python code