diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index f203ccc..1c468ed 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -73,12 +73,6 @@
     // for the lifetime of this hidl_string.
     void setToExternal(const char *data, size_t size);
 
-    status_t readEmbeddedFromParcel(
-            const Parcel &parcel, size_t parentHandle, size_t parentOffset);
-
-    status_t writeEmbeddedToParcel(
-            Parcel *parcel, size_t parentHandle, size_t parentOffset) const;
-
     // offsetof(hidl_string, mBuffer) exposed since mBuffer is private.
     static const size_t kOffsetOfBuffer;
 
@@ -94,6 +88,12 @@
     void moveFrom(hidl_string &&);
 };
 
+status_t readEmbeddedFromParcel(hidl_string *string,
+        const Parcel &parcel, size_t parentHandle, size_t parentOffset);
+
+status_t writeEmbeddedToParcel(const hidl_string &string,
+        Parcel *parcel, size_t parentHandle, size_t parentOffset);
+
 inline bool operator==(const hidl_string &hs, const char *s) {
     return strcmp(hs.c_str(), s) == 0;
 }
@@ -236,23 +236,12 @@
         mOwnsBuffer = true;
     }
 
-    status_t readEmbeddedFromParcel(
-            const Parcel &parcel,
-            size_t parentHandle,
-            size_t parentOffset,
-            size_t *handle);
-
-    status_t writeEmbeddedToParcel(
-            Parcel *parcel,
-            size_t parentHandle,
-            size_t parentOffset,
-            size_t *handle) const;
-
     status_t findInParcel(const Parcel &parcel, size_t *handle) const {
         return parcel.quickFindBuffer(mBuffer, handle);
     }
 
-
+    // offsetof(hidl_string, mBuffer) exposed since mBuffer is private.
+    static const size_t kOffsetOfBuffer;
 private:
     T *mBuffer;
     size_t mSize;
@@ -274,6 +263,39 @@
     }
 };
 
+template <typename T>
+const size_t hidl_vec<T>::kOffsetOfBuffer = offsetof(hidl_vec<T>, mBuffer);
+
+template<typename T>
+status_t readEmbeddedFromParcel(
+        hidl_vec<T> * /*vec*/,
+        const Parcel &parcel,
+        size_t parentHandle,
+        size_t parentOffset,
+        size_t *handle) {
+    const void *ptr = parcel.readEmbeddedBuffer(
+            handle,
+            parentHandle,
+            parentOffset + hidl_vec<T>::kOffsetOfBuffer);
+
+    return ptr != NULL ? OK : UNKNOWN_ERROR;
+}
+
+template<typename T>
+status_t writeEmbeddedToParcel(
+        const hidl_vec<T> &vec,
+        Parcel *parcel,
+        size_t parentHandle,
+        size_t parentOffset,
+        size_t *handle) {
+    return parcel->writeEmbeddedBuffer(
+            vec.data(),
+            sizeof(T) * vec.size(),
+            handle,
+            parentHandle,
+            parentOffset + hidl_vec<T>::kOffsetOfBuffer);
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 
 namespace details {
@@ -398,36 +420,6 @@
     T mBuffer[SIZE1];
 };
 
-////////////////////////////////////////////////////////////////////////////////
-
-template<typename T>
-status_t hidl_vec<T>::readEmbeddedFromParcel(
-        const Parcel &parcel,
-        size_t parentHandle,
-        size_t parentOffset,
-        size_t *handle) {
-    const void *ptr = parcel.readEmbeddedBuffer(
-            handle,
-            parentHandle,
-            parentOffset + offsetof(hidl_vec<T>, mBuffer));
-
-    return ptr != NULL ? OK : UNKNOWN_ERROR;
-}
-
-template<typename T>
-status_t hidl_vec<T>::writeEmbeddedToParcel(
-        Parcel *parcel,
-        size_t parentHandle,
-        size_t parentOffset,
-        size_t *handle) const {
-    return parcel->writeEmbeddedBuffer(
-            mBuffer,
-            sizeof(T) * mSize,
-            handle,
-            parentHandle,
-            parentOffset + offsetof(hidl_vec<T>, mBuffer));
-}
-
 ///////////////////////////// pointers for HIDL
 
 template <typename T>
diff --git a/include/hidl/MQDescriptor.h b/include/hidl/MQDescriptor.h
index 6e43749..f323834 100644
--- a/include/hidl/MQDescriptor.h
+++ b/include/hidl/MQDescriptor.h
@@ -69,20 +69,29 @@
 
     int32_t getFlags() const;
 
-    ::android::status_t readEmbeddedFromParcel(
-            const ::android::hardware::Parcel &parcel,
-            size_t parentHandle,
-            size_t parentOffset);
-
-    ::android::status_t writeEmbeddedToParcel(
-            ::android::hardware::Parcel *parcel,
-            size_t parentHandle,
-            size_t parentOffset) const;
-
     bool isHandleValid() const { return mHandle != nullptr; }
     size_t countGrantors() const { return mGrantors.size(); }
     std::vector<GrantorDescriptor> getGrantors() const;
     const sp<NativeHandle> getNativeHandle() const;
+
+    inline const ::android::hardware::hidl_vec<GrantorDescriptor> &grantors() const {
+        return mGrantors;
+    }
+
+    inline ::android::hardware::hidl_vec<GrantorDescriptor> &grantors() {
+        return mGrantors;
+    }
+
+    inline const ::native_handle_t *handle() const {
+        return mHandle;
+    }
+
+    inline ::native_handle_t *handle() {
+        return mHandle;
+    }
+
+    static const size_t kOffsetOfGrantors;
+    static const size_t kOffsetOfHandle;
     /*
      * There should atleast be GrantorDescriptors for the read counter, write
      * counter and data buffer.
@@ -96,6 +105,12 @@
     uint32_t mFlags;
 };
 
+template<MQFlavor flavor>
+const size_t MQDescriptor<flavor>::kOffsetOfGrantors = offsetof(MQDescriptor<flavor>, mGrantors);
+
+template<MQFlavor flavor>
+const size_t MQDescriptor<flavor>::kOffsetOfHandle = offsetof(MQDescriptor<flavor>, mHandle);
+
 /*
  * MQDescriptorSync will describe the wait-free synchronized
  * flavor of FMQ.
@@ -179,26 +194,27 @@
 }
 
 template<MQFlavor flavor>
-::android::status_t MQDescriptor<flavor>::readEmbeddedFromParcel(
-    const Parcel &parcel,
-    size_t parentHandle,
-    size_t parentOffset) {
+::android::status_t readEmbeddedFromParcel(
+        MQDescriptor<flavor> *obj,
+        const ::android::hardware::Parcel &parcel,
+        size_t parentHandle,
+        size_t parentOffset) {
     ::android::status_t _hidl_err = ::android::OK;
 
     size_t _hidl_grantors_child;
 
-    _hidl_err = const_cast<hidl_vec<GrantorDescriptor> *>(
-            &mGrantors)->readEmbeddedFromParcel(
+    _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+                &obj->grantors(),
                 parcel,
                 parentHandle,
-                parentOffset + offsetof(MQDescriptor, mGrantors),
+                parentOffset + MQDescriptor<flavor>::kOffsetOfGrantors,
                 &_hidl_grantors_child);
 
     if (_hidl_err != ::android::OK) { return _hidl_err; }
 
     const native_handle_t *_hidl_mq_handle_ptr = parcel.readEmbeddedNativeHandle(
             parentHandle,
-            parentOffset + offsetof(MQDescriptor, mHandle));
+            parentOffset + MQDescriptor<flavor>::kOffsetOfHandle);
 
     if (_hidl_mq_handle_ptr == nullptr) {
         _hidl_err = ::android::UNKNOWN_ERROR;
@@ -209,26 +225,28 @@
 }
 
 template<MQFlavor flavor>
-::android::status_t MQDescriptor<flavor>::writeEmbeddedToParcel(
-    Parcel *parcel,
-    size_t parentHandle,
-    size_t parentOffset) const {
+::android::status_t writeEmbeddedToParcel(
+        const MQDescriptor<flavor> &obj,
+        ::android::hardware::Parcel *parcel,
+        size_t parentHandle,
+        size_t parentOffset) {
     ::android::status_t _hidl_err = ::android::OK;
 
     size_t _hidl_grantors_child;
 
-    _hidl_err = mGrantors.writeEmbeddedToParcel(
+    _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+            obj.grantors(),
             parcel,
             parentHandle,
-            parentOffset + offsetof(MQDescriptor, mGrantors),
+            parentOffset + MQDescriptor<flavor>::kOffsetOfGrantors,
             &_hidl_grantors_child);
 
     if (_hidl_err != ::android::OK) { return _hidl_err; }
 
     _hidl_err = parcel->writeEmbeddedNativeHandle(
-            mHandle,
+            obj.handle(),
             parentHandle,
-            parentOffset + offsetof(MQDescriptor, mHandle));
+            parentOffset + MQDescriptor<flavor>::kOffsetOfHandle);
 
     if (_hidl_err != ::android::OK) { return _hidl_err; }
 
