refactoring serializer