Change marshalling to use implicit conversions