refactor SerializeDemo