Added to_dict function