refactored _from_dict_value logic