serialization refactor