Improve questionable code in Serializer