rewrite spell.lua