diff --git a/k6-tests/ncmp/common/passthrough-crud.js b/k6-tests/ncmp/common/passthrough-crud.js
index c5f2ddd..0cd96ad 100644
--- a/k6-tests/ncmp/common/passthrough-crud.js
+++ b/k6-tests/ncmp/common/passthrough-crud.js
@@ -18,33 +18,37 @@
  *  ============LICENSE_END=========================================================
  */
 
-import http from 'k6/http';
 import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
-import { TOTAL_CM_HANDLES, CONTENT_TYPE_JSON_PARAM, NCMP_BASE_URL, TOPIC_DATA_OPERATIONS_BATCH_READ } from './utils.js';
+import {
+    performPostRequest,
+    performGetRequest,
+    NCMP_BASE_URL,
+    TOPIC_DATA_OPERATIONS_BATCH_READ,
+    TOTAL_CM_HANDLES
+} from './utils.js';
 
 export function passthroughRead(useAlternateId) {
     const cmHandleReference = getRandomCmHandleReference(useAlternateId);
     const resourceIdentifier = 'my-resource-identifier';
-    const includeDescendants = true;
     const datastoreName = 'ncmp-datastore:passthrough-operational';
-    const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleReference}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}&include-descendants=${includeDescendants}`
-    const response = http.get(url);
-    return response;
+    const includeDescendants = true;
+    const url = generatePassthroughUrl(cmHandleReference, datastoreName, resourceIdentifier, includeDescendants);
+    return performGetRequest(url, 'passthroughRead');
 }
 
 export function passthroughWrite(useAlternateId) {
     const cmHandleReference = getRandomCmHandleReference(useAlternateId);
     const resourceIdentifier = 'my-resource-identifier';
     const datastoreName = 'ncmp-datastore:passthrough-running';
-    const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleReference}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}`
-    const body = `{"neType": "BaseStation"}`
-    const response = http.post(url, JSON.stringify(body), CONTENT_TYPE_JSON_PARAM);
-    return response;
+    const includeDescendants = false;
+    const url = generatePassthroughUrl(cmHandleReference, datastoreName, resourceIdentifier, includeDescendants);
+    const payload = JSON.stringify({"neType": "BaseStation"});
+    return performPostRequest(url, payload, 'passthroughWrite');
 }
 
 export function batchRead(cmHandleIds) {
-    const url = `${NCMP_BASE_URL}/ncmp/v1/data?topic=${TOPIC_DATA_OPERATIONS_BATCH_READ}`
-    const  payload = {
+    const url = `${NCMP_BASE_URL}/ncmp/v1/data?topic=${TOPIC_DATA_OPERATIONS_BATCH_READ}`;
+    const payload = JSON.stringify({
         "operations": [
             {
                 "resourceIdentifier": "parent/child",
@@ -55,12 +59,16 @@
                 "operation": "read"
             }
         ]
-    };
-    const response = http.post(url, JSON.stringify(payload), CONTENT_TYPE_JSON_PARAM);
-    return response;
+    });
+    return performPostRequest(url, payload, 'batchRead');
 }
 
 function getRandomCmHandleReference(useAlternateId) {
     const prefix = useAlternateId ? 'alt' : 'ch';
     return `${prefix}-${randomIntBetween(1, TOTAL_CM_HANDLES)}`;
 }
+
+function generatePassthroughUrl(cmHandleReference, datastoreName, resourceIdentifier, includeDescendants) {
+    const descendantsParam = includeDescendants ? `&include-descendants=${includeDescendants}` : '';
+    return `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleReference}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}${descendantsParam}`;
+}
\ No newline at end of file
