refactor spell_template