Added serialziation and deserialization functionality