Update marshaling logic