outlined code for new xstim structure