Externalize serialization and deserialization