Refactored marshalTypes to remove all the if cases