Refactored for dictionary.