Refactor serialization framework.