Refactoring serialization.