Modified to work with spells.