Refactored spell name resolution process