refactoring serializator