refactor serializer