moving magic class out of this