Serialization refactored