Small refactoring of marshaller\unmarshaller code