Added serialize/deserialize to save and load methods.