Updated to_dict method to use the properties() method instead of
iterating over _prop_names