refactored join_dictionaries()