Added code comments to magic.py
Fixed bugs in magic.py and setup.py