refactor spell_template
fix errors
Merge pull request #1 from almagest/refactor

Refactor template script to not be a fuckload of nested ifs