Custom serializer logic