improvement on from_dict methods