Serialization refactoring.