Refactored 'adding to comparison to dictionary'