reorging serialization/deserialization