made more extensible by allowing to inject custom serializer classes