deserialize refactoring