serialize
refactoring