serialization initial refactoring