very rough initial code for mag_t and arb_t types