Refactor DictionaryFactory