get_merged_dict refactoring

Plus pure function.