create_dict refactored