Use generic marshaller

It simplifies the code.