refactored serializer