Spell code reorganization