Implemented a custom serializer