Refactor in preparation for dictionary-based approach