Added some code to support pluggable serializers