made mbi and magic global variables