Added mage and fixed a lot of bugs.