Serialization refactor