Another round of marshalling refactoring