Added initial code for mage class

fixes #231