diff --git a/device_simulator/voltha_bal_driver.c b/device_simulator/voltha_bal_driver.c
index 796c755..83a83ef 100755
--- a/device_simulator/voltha_bal_driver.c
+++ b/device_simulator/voltha_bal_driver.c
@@ -33,12 +33,19 @@
 
 #include <unistd.h>
 #include <sys/reboot.h>
+#include "bal_indications_queue.h"
 
 /* Global varibles */
 balCoreIpInfo coreIpPortInfo;
 
-static grpc_c_server_t *test_server;
+/* extern variables*/
+list_node *bal_ind_queue_tail = NULL;
+list_node *bal_ind_queue_head = NULL;
+pthread_mutex_t bal_ind_queue_lock;
+unsigned int num_of_nodes = 0;
 
+/* static variables*/
+static grpc_c_server_t *test_server;
 static void sigint_handler (int x) {
    grpc_c_server_destroy(test_server);
    exit(0);
@@ -149,7 +156,7 @@
         ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status\n");
     }
 
-   system("shutdown -r now");
+   ret_val = system("shutdown -r now");
    sleep(30);  /* allow system to shutdown gracefully */
    sync();  /* force shutdown if graceful did not work */
    reboot(RB_AUTOBOOT);
@@ -444,43 +451,412 @@
 
 }
 
+void bal_get_ind__free_mem_access_term_ind(BalIndications *balIndCfg)
+{
+   free(balIndCfg->access_term_ind->data->sw_version);
+   free(balIndCfg->access_term_ind->data->topology);
+   free(balIndCfg->access_term_ind->data);
+   free(balIndCfg->access_term_ind->key);
+   free(balIndCfg->access_term_ind->hdr);
+   free(balIndCfg->access_term_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_access_term_ind_op_state(BalIndications *balIndCfg)
+{
+   free(balIndCfg->access_term_ind_op_state->data);
+   free(balIndCfg->access_term_ind_op_state->key);
+   free(balIndCfg->access_term_ind_op_state->hdr);
+   free(balIndCfg->access_term_ind_op_state);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_flow_op_state(BalIndications *balIndCfg)
+{
+   free(balIndCfg->flow_op_state->data);
+   free(balIndCfg->flow_op_state->key);
+   free(balIndCfg->flow_op_state->hdr);
+   free(balIndCfg->flow_op_state);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_flow_ind(BalIndications *balIndCfg)
+{
+   free(balIndCfg->flow_ind->data->action);
+   free(balIndCfg->flow_ind->data->classifier->src_mac.data);
+   free(balIndCfg->flow_ind->data->classifier->dst_mac.data);
+   free(balIndCfg->flow_ind->data->classifier);
+   free(balIndCfg->flow_ind->data);
+   free(balIndCfg->flow_ind->key);
+   free(balIndCfg->flow_ind->hdr);
+   free(balIndCfg->flow_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_group_ind(BalIndications *balIndCfg)
+{
+   int i = 0;
+   free(balIndCfg->group_ind->data->flows->val);
+   free(balIndCfg->group_ind->data->flows);
+   for (i = 0; i < balIndCfg->group_ind->data->members->n_val; i++)
+   {
+      free(balIndCfg->group_ind->data->members->val[i]->queue);
+      free(balIndCfg->group_ind->data->members->val[i]->action);
+   }
+   free(balIndCfg->group_ind->data->members->val);
+   free(balIndCfg->group_ind->data->members);
+   free(balIndCfg->group_ind->data);
+   free(balIndCfg->group_ind->key);
+   free(balIndCfg->group_ind->hdr);
+   free(balIndCfg->group_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_interface_op_state(BalIndications *balIndCfg)
+{
+   free(balIndCfg->interface_op_state->data);
+   free(balIndCfg->interface_op_state->key);
+   free(balIndCfg->interface_op_state->hdr);
+   free(balIndCfg->interface_op_state);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_interface_los(BalIndications *balIndCfg)
+{
+   free(balIndCfg->interface_los->data);
+   free(balIndCfg->interface_los->hdr);
+   free(balIndCfg->interface_los); 
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_interface_ind(BalIndications *balIndCfg)
+{
+   free(balIndCfg->interface_ind->data->sub_term_id_list->val);
+   free(balIndCfg->interface_ind->data->sub_term_id_list);
+   free(balIndCfg->interface_ind->data);
+   free(balIndCfg->interface_ind->key);
+   free(balIndCfg->interface_ind->hdr);
+   free(balIndCfg->interface_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_op_state(BalIndications *balIndCfg)
+{
+   free(balIndCfg->terminal_op_state->data);
+   free(balIndCfg->terminal_op_state->key);
+   free(balIndCfg->terminal_op_state->hdr);
+   free(balIndCfg->terminal_op_state);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_disc(BalIndications *balIndCfg)
+{
+   free(balIndCfg->terminal_disc->data->serial_number->vendor_specific);
+   free(balIndCfg->terminal_disc->data->serial_number->vendor_id);
+   free(balIndCfg->terminal_disc->data->serial_number);
+   free(balIndCfg->terminal_disc->data);
+   free(balIndCfg->terminal_disc->key);
+   free(balIndCfg->terminal_disc->hdr);
+   free(balIndCfg->terminal_disc);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_alarm(BalIndications *balIndCfg)
+{
+   free(balIndCfg->terminal_alarm->data->alarm);
+   free(balIndCfg->terminal_alarm->data);
+   free(balIndCfg->terminal_alarm->key);
+   free(balIndCfg->terminal_alarm->hdr);
+   free(balIndCfg->terminal_alarm);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_dgi(BalIndications *balIndCfg)
+{
+   free(balIndCfg->terminal_dgi->data);
+   free(balIndCfg->terminal_dgi->key);
+   free(balIndCfg->terminal_dgi->hdr);
+   free(balIndCfg->terminal_dgi);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_ind(BalIndications *balIndCfg)
+{
+   free(balIndCfg->terminal_ind->data->agg_port_id_list);
+   free(balIndCfg->terminal_ind->data->serial_number->vendor_specific);
+   free(balIndCfg->terminal_ind->data->serial_number->vendor_id);
+   free(balIndCfg->terminal_ind->data->serial_number);
+   free(balIndCfg->terminal_ind->data->registration_id);
+   free(balIndCfg->terminal_ind->data->password);
+   free(balIndCfg->terminal_ind->data);
+   free(balIndCfg->terminal_ind->key);
+   free(balIndCfg->terminal_ind->hdr);
+   free(balIndCfg->terminal_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_tm_queue_ind(BalIndications *balIndCfg)
+{
+   switch (balIndCfg->tm_queue_ind->data->bac->type)
+   {
+      case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_TAILDROP:
+        free(balIndCfg->tm_queue_ind->data->bac->taildrop);
+	break;
+      case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_WTAILDROP:
+        /*Nothing to do*/
+        break;
+      case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_RED:
+        free(balIndCfg->tm_queue_ind->data->bac->red->red);
+        free(balIndCfg->tm_queue_ind->data->bac->red);
+	break;
+      case BAL_TM_BAC_TYPE__BAL_TM_BAC_TYPE_WRED:
+        free(balIndCfg->tm_queue_ind->data->bac->wred->red);
+	free(balIndCfg->tm_queue_ind->data->bac->wred->yellow);
+	free(balIndCfg->tm_queue_ind->data->bac->wred->green);
+	free(balIndCfg->tm_queue_ind->data->bac->wred);
+      default:
+        /*Nothing to do*/
+         break;
+   }
+   free(balIndCfg->tm_queue_ind->data->bac);
+   free(balIndCfg->tm_queue_ind->data->rate);
+   free(balIndCfg->tm_queue_ind->data);
+   free(balIndCfg->tm_queue_ind->key);
+   free(balIndCfg->tm_queue_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_tm_sched_ind(BalIndications *balIndCfg)
+{
+   free(balIndCfg->tm_sched_ind->data);
+   free(balIndCfg->tm_sched_ind->key);
+   free(balIndCfg->tm_sched_ind);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_pkt_data(BalIndications *balIndCfg)
+{
+   free(balIndCfg->pktdata->data->pkt.data);
+   free(balIndCfg->pktdata->data);
+   switch(balIndCfg->pktdata->key->packet_send_dest->type)
+   {
+      case BAL_DEST_TYPE__BAL_DEST_TYPE_NNI:
+         free(balIndCfg->pktdata->key->packet_send_dest->nni);
+         break;
+      case BAL_DEST_TYPE__BAL_DEST_TYPE_SUB_TERM:
+         free(balIndCfg->pktdata->key->packet_send_dest->sub_term);
+	 break;
+      case BAL_DEST_TYPE__BAL_DEST_TYPE_SVC_PORT:
+         free(balIndCfg->pktdata->key->packet_send_dest->svc_port);
+	 break;
+      default:
+         /*Nothing to do*/
+         break;
+   }
+   free(balIndCfg->pktdata->key->packet_send_dest);
+   free(balIndCfg->pktdata->key);
+   free(balIndCfg->pktdata->hdr);
+   free(balIndCfg->pktdata);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_bal_omci_resp(BalIndications *balIndCfg)
+{
+   switch(balIndCfg->balomciresp->key->packet_send_dest->type)
+   {
+      case BAL_DEST_TYPE__BAL_DEST_TYPE_ITU_OMCI_CHANNEL:
+         free(balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel);
+         break;
+      default:
+         /*Nothing to do*/
+         break;
+   }
+   free(balIndCfg->balomciresp->key->packet_send_dest);
+   free(balIndCfg->balomciresp->data->pkt.data);
+   free(balIndCfg->balomciresp->data);
+   free(balIndCfg->balomciresp->key);
+   free(balIndCfg->balomciresp->hdr);
+   free(balIndCfg->balomciresp);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_bal_oam_resp(BalIndications *balIndCfg)
+{
+   free(balIndCfg->baloamresp->data->pkt.data);
+   free(balIndCfg->baloamresp->data);
+   switch(balIndCfg->baloamresp->key->packet_send_dest->type)
+   {
+      case BAL_DEST_TYPE__BAL_DEST_TYPE_IEEE_OAM_CHANNEL:
+         free(balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel);
+         break;
+      default:
+         /*Nothing to do*/
+         break;
+   }
+   free(balIndCfg->baloamresp->key->packet_send_dest);
+   free(balIndCfg->baloamresp->key);
+   free(balIndCfg->baloamresp->hdr);
+   free(balIndCfg->baloamresp);
+   free(balIndCfg);
+}
+
+void bal_get_ind__free_mem(BalIndications *balIndCfg)
+{
+    switch (balIndCfg->u_case)
+    {
+       case BAL_INDICATIONS__U_ACCESS_TERM_IND:
+          bal_get_ind__free_mem_access_term_ind(balIndCfg);
+          break;
+ 
+       case BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE:
+          bal_get_ind__free_mem_access_term_ind_op_state(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_FLOW_OP_STATE:
+          bal_get_ind__free_mem_flow_op_state(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_FLOW_IND:
+          bal_get_ind__free_mem_flow_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_GROUP_IND:
+          bal_get_ind__free_mem_group_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_INTERFACE_OP_STATE:
+          bal_get_ind__free_mem_interface_op_state(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_INTERFACE_LOS:
+          bal_get_ind__free_mem_interface_los(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_INTERFACE_IND:
+          bal_get_ind__free_mem_interface_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TERMINAL_OP_STATE:
+          bal_get_ind__free_mem_terminal_op_state(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TERMINAL_DISC:
+          bal_get_ind__free_mem_terminal_disc(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TERMINAL_ALARM:
+          bal_get_ind__free_mem_terminal_alarm(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TERMINAL_DGI:
+          bal_get_ind__free_mem_terminal_dgi(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TERMINAL_IND:
+          bal_get_ind__free_mem_terminal_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TM_QUEUE__IND:
+          bal_get_ind__free_mem_tm_queue_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_TM_SCHED__IND:
+          bal_get_ind__free_mem_u_tm_sched_ind(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_PKT_DATA:
+          bal_get_ind__free_mem_u_pkt_data(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_BAL_OMCI_RESP:
+          bal_get_ind__free_mem_u_bal_omci_resp(balIndCfg);
+          break;
+
+       case BAL_INDICATIONS__U_BAL_OAM_RESP:
+          bal_get_ind__free_mem_u_bal_oam_resp(balIndCfg);
+          break;
+
+       default:
+          ASFVOLT_LOG(ASFVOLT_ERROR, "Unknown case %lu\n", balIndCfg->u_case);
+          break;
+    }
+}
+
+void bal_get_ind__bal_get_ind_from_device_cb(grpc_c_context_t *context)
+{
+   BalDefault *dummy;
+   BalIndications *bal_indication;
+   list_node *node = NULL;
+   int ret_val = 0;
+
+   /*
+    * Read incoming message into set_cfg
+    */
+   if (context->gcc_payload) {
+      context->gcc_stream->read(context, (void **)&dummy, 0);
+   }
+
+   /*
+    * send it to BAL
+    */
+
+   pthread_mutex_lock(&bal_ind_queue_lock);
+   node = get_bal_indication_node();
+   pthread_mutex_unlock(&bal_ind_queue_lock);
+     
+   if(node != NULL)
+   {
+      bal_indication = node->bal_indication;
+      bal_indication->ind_present = true;
+      bal_indication->has_ind_present = true;
+   }
+   else
+   {
+      bal_indication = malloc(sizeof(BalIndications));
+      memset(bal_indication, 0, sizeof(BalIndications));
+      bal_indications__init(bal_indication);
+      bal_indication->ind_present = false;
+      bal_indication->has_ind_present = true;
+   }
+
+   /*
+    * Write reply back to the client
+    */
+
+   ret_val = context->gcc_stream->write(context, bal_indication, 0);
+   is_grpc_write_pending(ret_val);
+
+   grpc_c_status_t status;
+   status.gcs_code = 0;
+
+   /*
+    * Finish response for RPC
+    */
+   if (context->gcc_stream->finish(context, &status))
+   {
+      ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status\n");
+   }
+   
+   /*Free memory for 'bal_indication' and 'node'*/
+   if (bal_indication->ind_present)
+   {
+      bal_get_ind__free_mem(bal_indication);
+      free(node);
+   }
+   else
+   {
+      free(bal_indication);
+   }
+}
 
 /*
  * This functions gets invoked whenever bal finish RPC gets called
  */
 void bal__bal_api_finish_cb(grpc_c_context_t *context)
 {
-#if 0
-   void *finish_init;
 
-   /*
-    * Read incoming message into set_cfg
-    */
-   if (context->gcc_payload) {
-      context->gcc_stream->read(context, (void **)&finish_init);
-   }
-#endif
 }
 
-#if 0
-/*
- * This functions gets invoked whenever bal finish RPC gets called
- */
-void bal_ind__bal_ind_info_cb(grpc_c_context_t *context)
-{
-#if 0
-   void *finish_init;
-
-   /*
-    * Read incoming message into set_cfg
-    */
-   if (context->gcc_payload) {
-      context->gcc_stream->read(context, (void **)&finish_init);
-   }
-#endif
-}
-#endif
-
 void bal_ind__bal_acc_term_ind_cb(grpc_c_context_t *context)
 {
 }
@@ -581,6 +957,7 @@
     */
    ASFVOLT_LOG(ASFVOLT_INFO, "\nvoltha_bal_driver running.....\n");
    bal__service_init(test_server);
+   bal_get_ind__service_init(test_server);
 
    /*
     * Start server
@@ -598,5 +975,5 @@
 
    /* code added for example Makefile to compile grpc-c along with edgecore driver */
    bal__service_init(server);
-
+   bal_get_ind__service_init(server);
 }
diff --git a/src/Makefile b/src/Makefile
index 21e5964..dce86eb 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,6 +16,7 @@
 	bal_access_terminal_hdlr.c \
 	bal_flow_hdlr.c \
 	bal_group_hdlr.c \
+        bal_indications_queue.c \
 	bal_indications_hdlr.c \
 	bal_interface_hdlr.c \
 	bal_packet_hdlr.c \
diff --git a/src/bal_indications_hdlr.c b/src/bal_indications_hdlr.c
index df75a58..b807c73 100755
--- a/src/bal_indications_hdlr.c
+++ b/src/bal_indications_hdlr.c
@@ -15,6 +15,12 @@
 */
 
 #include "bal_indications_hdlr.h"
+#include "bal_indications_queue.h"
+
+/*global variables*/
+
+/*extern variables*/
+
 
 /*static bcmos_mutex bal_ind_lock; - Need to define bcm independent mutex*/
 /********************************************************************\
@@ -38,100 +44,108 @@
    {
       ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API \'%s\' IND callback (status is %s)\n",
 				  bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_access_terminal_ind *acc_term_ind = (bcmbal_access_terminal_ind *)obj;
 
-      BalAccessTerminalInd acessTermInd;
-      memset(&acessTermInd, 0, sizeof(BalAccessTerminalInd));
-      bal_access_terminal_ind__init(&acessTermInd);
-      balIndCfg.access_term_ind = &acessTermInd;
+      balIndCfg->access_term_ind = malloc(sizeof(BalAccessTerminalInd));
+      memset(balIndCfg->access_term_ind, 0, sizeof(BalAccessTerminalInd));
+      bal_access_terminal_ind__init(balIndCfg->access_term_ind);
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.access_term_ind->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->access_term_ind->hdr = hdr;
 
-      BalAccessTerminalKey accessTermkey;
-      memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey));
-      bal_access_terminal_key__init(&accessTermkey);
-      balIndCfg.access_term_ind->key = &accessTermkey;
+      BalAccessTerminalKey *accessTermkey;
+      accessTermkey = malloc(sizeof(BalAccessTerminalKey));
+      memset(accessTermkey, 0, sizeof(BalAccessTerminalKey));
+      bal_access_terminal_key__init(accessTermkey);
+      balIndCfg->access_term_ind->key = accessTermkey;
+      balIndCfg->access_term_ind->key->has_access_term_id = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->key->access_term_id = acc_term_ind->key.access_term_id;
 
-      balIndCfg.access_term_ind->key->has_access_term_id = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->key->access_term_id = acc_term_ind->key.access_term_id;
+      BalAccessTerminalIndData *accessTermIndData;
+      accessTermIndData = malloc(sizeof(BalAccessTerminalIndData));
+      memset(accessTermIndData, 0, sizeof(BalAccessTerminalIndData));
+      bal_access_terminal_ind_data__init(accessTermIndData);
+      balIndCfg->access_term_ind->data = accessTermIndData;
+      balIndCfg->access_term_ind->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->admin_state = acc_term_ind->data.admin_state;
+      balIndCfg->access_term_ind->data->has_oper_status = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->oper_status = acc_term_ind->data.oper_status;
+      balIndCfg->access_term_ind->data->has_iwf_mode = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->iwf_mode = acc_term_ind->data.iwf_mode;
 
-      BalAccessTerminalIndData accessTermIndData;
-      memset(&accessTermIndData, 0, sizeof(BalAccessTerminalIndData));
-      bal_access_terminal_ind_data__init(&accessTermIndData);
-      balIndCfg.access_term_ind->data = &accessTermIndData;
+      BalTopology *balTop;
+      balTop = malloc(sizeof(BalTopology));
+      memset(balTop, 0, sizeof(BalTopology));
+      bal_topology__init(balTop);
+      balIndCfg->access_term_ind->data->topology = balTop;
 
-      balIndCfg.access_term_ind->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->admin_state = acc_term_ind->data.admin_state;
-      balIndCfg.access_term_ind->data->has_oper_status = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->oper_status = acc_term_ind->data.oper_status;
-      balIndCfg.access_term_ind->data->has_iwf_mode = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->iwf_mode = acc_term_ind->data.iwf_mode;
-
-      BalTopology balTop;
-      memset(&balTop, 0, sizeof(BalTopology));
-      bal_topology__init(&balTop);
-      balIndCfg.access_term_ind->data->topology = &balTop;
-
-      balIndCfg.access_term_ind->data->topology->has_num_of_nni_ports = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->num_of_nni_ports =
+      balIndCfg->access_term_ind->data->topology->has_num_of_nni_ports = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->num_of_nni_ports =
                                             acc_term_ind->data.topology.num_of_nni_ports;
-      balIndCfg.access_term_ind->data->topology->has_num_of_pon_ports = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->num_of_pon_ports =
+      balIndCfg->access_term_ind->data->topology->has_num_of_pon_ports = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->num_of_pon_ports =
                                             acc_term_ind->data.topology.num_of_pon_ports;
-      balIndCfg.access_term_ind->data->topology->has_num_of_mac_devs = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->num_of_mac_devs =
+      balIndCfg->access_term_ind->data->topology->has_num_of_mac_devs = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->num_of_mac_devs =
                                              acc_term_ind->data.topology.num_of_mac_devs;
-      balIndCfg.access_term_ind->data->topology->has_num_of_pons_per_mac_dev = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->num_of_pons_per_mac_dev =
+      balIndCfg->access_term_ind->data->topology->has_num_of_pons_per_mac_dev = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->num_of_pons_per_mac_dev =
                                       acc_term_ind->data.topology.num_of_pons_per_mac_dev;
-      balIndCfg.access_term_ind->data->topology->has_pon_family = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->pon_family =
+      balIndCfg->access_term_ind->data->topology->has_pon_family = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->pon_family =
                                                    acc_term_ind->data.topology.pon_family;
-      balIndCfg.access_term_ind->data->topology->has_pon_sub_family = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->topology->pon_sub_family =
+      balIndCfg->access_term_ind->data->topology->has_pon_sub_family = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->topology->pon_sub_family =
                                                 acc_term_ind->data.topology.pon_sub_family;
 
-      BalSwVersion balsv;
-      memset(&balsv, 0, sizeof(BalSwVersion));
-      bal_sw_version__init(&balsv);
-      balIndCfg.access_term_ind->data->sw_version = &balsv;
+      BalSwVersion *balsv;
+      balsv = malloc(sizeof(BalSwVersion));
+      memset(balsv, 0, sizeof(BalSwVersion));
+      bal_sw_version__init(balsv);
+      balIndCfg->access_term_ind->data->sw_version = balsv;
 
-      balIndCfg.access_term_ind->data->sw_version->has_version_type = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->version_type =
+      balIndCfg->access_term_ind->data->sw_version->has_version_type = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->version_type =
                                                 acc_term_ind->data.sw_version.version_type;
-      balIndCfg.access_term_ind->data->sw_version->has_major_rev = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->major_rev =
+      balIndCfg->access_term_ind->data->sw_version->has_major_rev = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->major_rev =
                                                    acc_term_ind->data.sw_version.major_rev;
-      balIndCfg.access_term_ind->data->sw_version->has_minor_rev = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->minor_rev =
+      balIndCfg->access_term_ind->data->sw_version->has_minor_rev = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->minor_rev =
                                                    acc_term_ind->data.sw_version.minor_rev;
-      balIndCfg.access_term_ind->data->sw_version->has_patch_rev = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->patch_rev =
+      balIndCfg->access_term_ind->data->sw_version->has_patch_rev = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->patch_rev =
                                                    acc_term_ind->data.sw_version.patch_rev;
-      balIndCfg.access_term_ind->data->sw_version->has_om_version = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->om_version =
+      balIndCfg->access_term_ind->data->sw_version->has_om_version = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->om_version =
                                                   acc_term_ind->data.sw_version.om_version;
-      balIndCfg.access_term_ind->data->sw_version->has_dev_point = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind->data->sw_version->dev_point =
+      balIndCfg->access_term_ind->data->sw_version->has_dev_point = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind->data->sw_version->dev_point =
                                                    acc_term_ind->data.sw_version.dev_point;
 
       bal_register_indication_cbs();
 
-      BalErr *output;
-      result = bal_ind__bal_acc_term_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+      
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
+
       is_reboot = BAL_REBOOT_STATUS__BAL_OLT_UP_AFTER_ACTIVATION;
    }
 
@@ -157,55 +171,62 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_access_terminal_oper_status_change *acc_term_osc =
                                   (bcmbal_access_terminal_oper_status_change *)obj;
 
-      BalAccessTerminalOperStatusChange acessTermOSC;
-      memset(&acessTermOSC, 0, sizeof(BalAccessTerminalOperStatusChange));
-      bal_access_terminal_oper_status_change__init(&acessTermOSC);
-      balIndCfg.access_term_ind_op_state = &acessTermOSC;
+      BalAccessTerminalOperStatusChange *acessTermOSC;
+      acessTermOSC = malloc(sizeof(BalAccessTerminalOperStatusChange));
+      memset(acessTermOSC, 0, sizeof(BalAccessTerminalOperStatusChange));
+      bal_access_terminal_oper_status_change__init(acessTermOSC);
+      balIndCfg->access_term_ind_op_state = acessTermOSC;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.access_term_ind_op_state->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->access_term_ind_op_state->hdr = hdr;
 
-      BalAccessTerminalKey accessTermkey;
-      memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey));
-      bal_access_terminal_key__init(&accessTermkey);
-      balIndCfg.access_term_ind_op_state->key = &accessTermkey;
-
-      balIndCfg.access_term_ind_op_state->key->has_access_term_id = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind_op_state->key->access_term_id =
+      BalAccessTerminalKey *accessTermkey;
+      accessTermkey = malloc(sizeof(BalAccessTerminalKey));
+      memset(accessTermkey, 0, sizeof(BalAccessTerminalKey));
+      bal_access_terminal_key__init(accessTermkey);
+      balIndCfg->access_term_ind_op_state->key = accessTermkey;
+      balIndCfg->access_term_ind_op_state->key->has_access_term_id = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind_op_state->key->access_term_id =
                                                   acc_term_osc->key.access_term_id;
 
-      BalAccessTerminalOperStatusChangeData accessTermOscData;
-      memset(&accessTermOscData, 0, sizeof(BalAccessTerminalOperStatusChangeData));
-      bal_access_terminal_oper_status_change_data__init(&accessTermOscData);
-      balIndCfg.access_term_ind_op_state->data = &accessTermOscData;
-
-      balIndCfg.access_term_ind_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind_op_state->data->new_oper_status =
+      BalAccessTerminalOperStatusChangeData *accessTermOscData;
+      accessTermOscData = malloc(sizeof(BalAccessTerminalOperStatusChangeData));
+      memset(accessTermOscData, 0, sizeof(BalAccessTerminalOperStatusChangeData));
+      bal_access_terminal_oper_status_change_data__init(accessTermOscData);
+      balIndCfg->access_term_ind_op_state->data = accessTermOscData;
+      balIndCfg->access_term_ind_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind_op_state->data->new_oper_status =
                                                  acc_term_osc->data.new_oper_status;
-      balIndCfg.access_term_ind_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind_op_state->data->old_oper_status =
+      balIndCfg->access_term_ind_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind_op_state->data->old_oper_status =
                                                  acc_term_osc->data.old_oper_status;
-      balIndCfg.access_term_ind_op_state->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.access_term_ind_op_state->data->admin_state =
+      balIndCfg->access_term_ind_op_state->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->access_term_ind_op_state->data->admin_state =
                                                  acc_term_osc->data.admin_state;
 
-      BalErr *output;
-      result = bal_ind__bal_acc_term_oper_sts_cng_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -230,58 +251,67 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_OP_STATE;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_OP_STATE;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_flow_oper_status_change *flow_osc = (bcmbal_flow_oper_status_change *)obj;
 
-      BalFlowOperStatusChange flowOscInd;
-      memset(&flowOscInd, 0, sizeof(BalFlowOperStatusChange));
-      bal_flow_oper_status_change__init(&flowOscInd);
-      balIndCfg.flow_op_state = &flowOscInd;
+      BalFlowOperStatusChange *flowOscInd;
+      flowOscInd = malloc(sizeof(BalFlowOperStatusChange));
+      memset(flowOscInd, 0, sizeof(BalFlowOperStatusChange));
+      bal_flow_oper_status_change__init(flowOscInd);
+      balIndCfg->flow_op_state = flowOscInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.flow_op_state->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->flow_op_state->hdr = hdr;
 
-      BalFlowKey flowkey;
-      memset(&flowkey, 0, sizeof(BalFlowKey));
-      bal_flow_key__init(&flowkey);
-      balIndCfg.flow_op_state->key = &flowkey;
+      BalFlowKey *flowkey;
+      flowkey = malloc(sizeof(BalFlowKey));
+      memset(flowkey, 0, sizeof(BalFlowKey));
+      bal_flow_key__init(flowkey);
+      balIndCfg->flow_op_state->key = flowkey;
 
-      balIndCfg.flow_op_state->key->has_flow_id = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->key->flow_id = flow_osc->key.flow_id;
-      balIndCfg.flow_op_state->key->has_flow_type = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->key->flow_type = flow_osc->key.flow_type;
+      balIndCfg->flow_op_state->key->has_flow_id = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->key->flow_id = flow_osc->key.flow_id;
+      balIndCfg->flow_op_state->key->has_flow_type = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->key->flow_type = flow_osc->key.flow_type;
 
-      BalFlowOperStatusChangeData flowOscIndData;
-      memset(&flowOscIndData, 0, sizeof(BalFlowOperStatusChangeData));
-      bal_flow_oper_status_change_data__init(&flowOscIndData);
-      balIndCfg.flow_op_state->data = &flowOscIndData;
+      BalFlowOperStatusChangeData *flowOscIndData;
+      flowOscIndData = malloc(sizeof(BalFlowOperStatusChangeData));
+      memset(flowOscIndData, 0, sizeof(BalFlowOperStatusChangeData));
+      bal_flow_oper_status_change_data__init(flowOscIndData);
+      balIndCfg->flow_op_state->data = flowOscIndData;
 
-      balIndCfg.flow_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->new_oper_status = flow_osc->data.new_oper_status;
-      balIndCfg.flow_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->old_oper_status = flow_osc->data.old_oper_status;
-      balIndCfg.flow_op_state->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->admin_state = flow_osc->data.admin_state;
-      balIndCfg.flow_op_state->data->has_svc_port_id = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->svc_port_id = flow_osc->data.svc_port_id;
-      balIndCfg.flow_op_state->data->has_dba_tm_sched_id = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->dba_tm_sched_id = flow_osc->data.dba_tm_sched_id;
-      balIndCfg.flow_op_state->data->has_cookie = BAL_GRPC_PRES;
-      balIndCfg.flow_op_state->data->cookie = flow_osc->data.cookie;
+      balIndCfg->flow_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->new_oper_status = flow_osc->data.new_oper_status;
+      balIndCfg->flow_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->old_oper_status = flow_osc->data.old_oper_status;
+      balIndCfg->flow_op_state->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->admin_state = flow_osc->data.admin_state;
+      balIndCfg->flow_op_state->data->has_svc_port_id = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->svc_port_id = flow_osc->data.svc_port_id;
+      balIndCfg->flow_op_state->data->has_dba_tm_sched_id = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->dba_tm_sched_id = flow_osc->data.dba_tm_sched_id;
+      balIndCfg->flow_op_state->data->has_cookie = BAL_GRPC_PRES;
+      balIndCfg->flow_op_state->data->cookie = flow_osc->data.cookie;
 
-      BalErr *output;
-      result = bal_ind__bal_flow_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -306,135 +336,147 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_flow_ind *flow_ind = (bcmbal_flow_ind *)obj;
 
-      BalFlowInd flowInd;
-      memset(&flowInd, 0, sizeof(BalFlowInd));
-      bal_flow_ind__init(&flowInd);
-      balIndCfg.flow_ind = &flowInd;
+      BalFlowInd *flowInd;
+      flowInd = malloc(sizeof(BalFlowInd));
+      memset(flowInd, 0, sizeof(BalFlowInd));
+      bal_flow_ind__init(flowInd);
+      balIndCfg->flow_ind = flowInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.flow_ind->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->flow_ind->hdr = hdr;
 
-      BalFlowKey flowkey;
-      memset(&flowkey, 0, sizeof(BalFlowKey));
-      bal_flow_key__init(&flowkey);
-      balIndCfg.flow_ind->key = &flowkey;
+      BalFlowKey *flowkey;
+      flowkey = malloc(sizeof(BalFlowKey));
+      memset(flowkey, 0, sizeof(BalFlowKey));
+      bal_flow_key__init(flowkey);
+      balIndCfg->flow_ind->key = flowkey;
 
-      balIndCfg.flow_ind->key->has_flow_id = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->key->flow_id = flow_ind->key.flow_id;
-      balIndCfg.flow_ind->key->has_flow_type = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->key->flow_type = flow_ind->key.flow_type;
+      balIndCfg->flow_ind->key->has_flow_id = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->key->flow_id = flow_ind->key.flow_id;
+      balIndCfg->flow_ind->key->has_flow_type = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->key->flow_type = flow_ind->key.flow_type;
 
-      BalFlowIndData flowIndData;
-      memset(&flowIndData, 0, sizeof(BalFlowIndData));
-      bal_flow_ind_data__init(&flowIndData);
-      balIndCfg.flow_ind->data = &flowIndData;
+      BalFlowIndData *flowIndData;
+      flowIndData = malloc(sizeof(BalFlowIndData));
+      memset(flowIndData, 0, sizeof(BalFlowIndData));
+      bal_flow_ind_data__init(flowIndData);
+      balIndCfg->flow_ind->data = flowIndData;
 
-      balIndCfg.flow_ind->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->admin_state = flow_ind->data.admin_state;
-      balIndCfg.flow_ind->data->has_oper_status= BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->oper_status= flow_ind->data.oper_status;
-      balIndCfg.flow_ind->data->has_access_int_id = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->access_int_id = flow_ind->data.access_int_id;
-      balIndCfg.flow_ind->data->has_network_int_id = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->network_int_id = flow_ind->data.network_int_id;
-      balIndCfg.flow_ind->data->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->sub_term_id = flow_ind->data.sub_term_id;
-      balIndCfg.flow_ind->data->has_sub_term_uni_idx = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->sub_term_uni_idx = flow_ind->data.sub_term_uni_idx;
-      balIndCfg.flow_ind->data->has_svc_port_id = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->svc_port_id = flow_ind->data.svc_port_id;
-      balIndCfg.flow_ind->data->has_resolve_mac = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->resolve_mac = flow_ind->data.resolve_mac;
-      balIndCfg.flow_ind->data->has_cookie = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->cookie = flow_ind->data.cookie;
+      balIndCfg->flow_ind->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->admin_state = flow_ind->data.admin_state;
+      balIndCfg->flow_ind->data->has_oper_status= BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->oper_status= flow_ind->data.oper_status;
+      balIndCfg->flow_ind->data->has_access_int_id = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->access_int_id = flow_ind->data.access_int_id;
+      balIndCfg->flow_ind->data->has_network_int_id = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->network_int_id = flow_ind->data.network_int_id;
+      balIndCfg->flow_ind->data->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->sub_term_id = flow_ind->data.sub_term_id;
+      balIndCfg->flow_ind->data->has_sub_term_uni_idx = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->sub_term_uni_idx = flow_ind->data.sub_term_uni_idx;
+      balIndCfg->flow_ind->data->has_svc_port_id = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->svc_port_id = flow_ind->data.svc_port_id;
+      balIndCfg->flow_ind->data->has_resolve_mac = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->resolve_mac = flow_ind->data.resolve_mac;
+      balIndCfg->flow_ind->data->has_cookie = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->cookie = flow_ind->data.cookie;
 
-      BalClassifier balClassifier;
-      memset(&balClassifier, 0, sizeof(BalClassifier));
-      bal_classifier__init(&balClassifier);
-      balIndCfg.flow_ind->data->classifier = &balClassifier;
+      BalClassifier *balClassifier;
+      balClassifier = malloc(sizeof(BalClassifier));
+      memset(balClassifier, 0, sizeof(BalClassifier));
+      bal_classifier__init(balClassifier);
+      balIndCfg->flow_ind->data->classifier = balClassifier;
 
-      balIndCfg.flow_ind->data->classifier->has_presence_mask = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->presence_mask = flow_ind->data.classifier.presence_mask;
-      balIndCfg.flow_ind->data->classifier->has_o_tpid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->o_tpid = flow_ind->data.classifier.o_tpid;
-      balIndCfg.flow_ind->data->classifier->has_o_vid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->o_vid = flow_ind->data.classifier.o_vid;
-      balIndCfg.flow_ind->data->classifier->has_i_tpid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->i_tpid = flow_ind->data.classifier.i_tpid;
-      balIndCfg.flow_ind->data->classifier->has_i_vid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->i_vid = flow_ind->data.classifier.i_vid;
-      balIndCfg.flow_ind->data->classifier->has_o_pbits = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->o_pbits = flow_ind->data.classifier.o_pbits;
-      balIndCfg.flow_ind->data->classifier->has_i_pbits = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->i_pbits = flow_ind->data.classifier.i_pbits;
-      balIndCfg.flow_ind->data->classifier->has_ether_type = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->ether_type = flow_ind->data.classifier.ether_type;
-      balIndCfg.flow_ind->data->classifier->has_dst_mac = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->dst_mac.len =
+      balIndCfg->flow_ind->data->classifier->has_presence_mask = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->presence_mask = flow_ind->data.classifier.presence_mask;
+      balIndCfg->flow_ind->data->classifier->has_o_tpid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->o_tpid = flow_ind->data.classifier.o_tpid;
+      balIndCfg->flow_ind->data->classifier->has_o_vid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->o_vid = flow_ind->data.classifier.o_vid;
+      balIndCfg->flow_ind->data->classifier->has_i_tpid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->i_tpid = flow_ind->data.classifier.i_tpid;
+      balIndCfg->flow_ind->data->classifier->has_i_vid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->i_vid = flow_ind->data.classifier.i_vid;
+      balIndCfg->flow_ind->data->classifier->has_o_pbits = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->o_pbits = flow_ind->data.classifier.o_pbits;
+      balIndCfg->flow_ind->data->classifier->has_i_pbits = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->i_pbits = flow_ind->data.classifier.i_pbits;
+      balIndCfg->flow_ind->data->classifier->has_ether_type = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->ether_type = flow_ind->data.classifier.ether_type;
+      balIndCfg->flow_ind->data->classifier->has_dst_mac = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->dst_mac.len =
                             (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.dst_mac.u8);
-      balIndCfg.flow_ind->data->classifier->dst_mac.data =
-           (uint8_t *)malloc((balIndCfg.flow_ind->data->classifier->dst_mac.len)*sizeof(uint8_t));
-      memcpy(balIndCfg.flow_ind->data->classifier->dst_mac.data,
+      balIndCfg->flow_ind->data->classifier->dst_mac.data =
+           (uint8_t *)malloc((balIndCfg->flow_ind->data->classifier->dst_mac.len)*sizeof(uint8_t));
+      memcpy(balIndCfg->flow_ind->data->classifier->dst_mac.data,
              flow_ind->data.classifier.dst_mac.u8,
-             balIndCfg.flow_ind->data->classifier->dst_mac.len);
-      balIndCfg.flow_ind->data->classifier->has_src_mac = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->src_mac.len =
+             balIndCfg->flow_ind->data->classifier->dst_mac.len);
+      balIndCfg->flow_ind->data->classifier->has_src_mac = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->src_mac.len =
                             (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.src_mac.u8);
-      balIndCfg.flow_ind->data->classifier->src_mac.data =
-           (uint8_t *)malloc((balIndCfg.flow_ind->data->classifier->src_mac.len)*sizeof(uint8_t));
-      memcpy(balIndCfg.flow_ind->data->classifier->src_mac.data,
+      balIndCfg->flow_ind->data->classifier->src_mac.data =
+           (uint8_t *)malloc((balIndCfg->flow_ind->data->classifier->src_mac.len)*sizeof(uint8_t));
+      memcpy(balIndCfg->flow_ind->data->classifier->src_mac.data,
              flow_ind->data.classifier.src_mac.u8,
-             balIndCfg.flow_ind->data->classifier->src_mac.len);
-      balIndCfg.flow_ind->data->classifier->has_ip_proto = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->ip_proto = flow_ind->data.classifier.ip_proto;
-      balIndCfg.flow_ind->data->classifier->has_dst_ip = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->dst_ip = flow_ind->data.classifier.dst_ip.u32;
-      balIndCfg.flow_ind->data->classifier->has_src_ip = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->src_ip = flow_ind->data.classifier.src_ip.u32;
-      balIndCfg.flow_ind->data->classifier->has_src_port = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->src_port = flow_ind->data.classifier.src_port;
-      balIndCfg.flow_ind->data->classifier->has_dst_port = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->dst_port = flow_ind->data.classifier.dst_port;
-      balIndCfg.flow_ind->data->classifier->has_pkt_tag_type = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->classifier->pkt_tag_type = flow_ind->data.classifier.pkt_tag_type;
+             balIndCfg->flow_ind->data->classifier->src_mac.len);
+      balIndCfg->flow_ind->data->classifier->has_ip_proto = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->ip_proto = flow_ind->data.classifier.ip_proto;
+      balIndCfg->flow_ind->data->classifier->has_dst_ip = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->dst_ip = flow_ind->data.classifier.dst_ip.u32;
+      balIndCfg->flow_ind->data->classifier->has_src_ip = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->src_ip = flow_ind->data.classifier.src_ip.u32;
+      balIndCfg->flow_ind->data->classifier->has_src_port = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->src_port = flow_ind->data.classifier.src_port;
+      balIndCfg->flow_ind->data->classifier->has_dst_port = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->dst_port = flow_ind->data.classifier.dst_port;
+      balIndCfg->flow_ind->data->classifier->has_pkt_tag_type = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->classifier->pkt_tag_type = flow_ind->data.classifier.pkt_tag_type;
 
-      BalAction balAction;
-      memset(&balAction, 0, sizeof(BalAction));
-      bal_action__init(&balAction);
-      balIndCfg.flow_ind->data->action = &balAction;
+      BalAction *balAction;
+      balAction = malloc(sizeof(BalAction));
+      memset(balAction, 0, sizeof(BalAction));
+      bal_action__init(balAction);
+      balIndCfg->flow_ind->data->action = balAction;
 
-      balIndCfg.flow_ind->data->action->has_presence_mask = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->presence_mask = flow_ind->data.action.presence_mask;
-      balIndCfg.flow_ind->data->action->has_cmds_bitmask = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->cmds_bitmask = flow_ind->data.action.cmds_bitmask;
-      balIndCfg.flow_ind->data->action->has_o_vid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->o_vid = flow_ind->data.action.o_vid;
-      balIndCfg.flow_ind->data->action->has_o_pbits = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->o_pbits = flow_ind->data.action.o_pbits;
-      balIndCfg.flow_ind->data->action->has_o_tpid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->o_tpid = flow_ind->data.action.o_tpid;
-      balIndCfg.flow_ind->data->action->has_i_vid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->i_vid = flow_ind->data.action.i_vid;
-      balIndCfg.flow_ind->data->action->has_i_pbits = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->i_pbits = flow_ind->data.action.i_pbits;
-      balIndCfg.flow_ind->data->action->has_i_tpid = BAL_GRPC_PRES;
-      balIndCfg.flow_ind->data->action->i_tpid = flow_ind->data.action.i_tpid;
-      BalErr *output;
-      result = bal_ind__bal_flow_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      balIndCfg->flow_ind->data->action->has_presence_mask = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->presence_mask = flow_ind->data.action.presence_mask;
+      balIndCfg->flow_ind->data->action->has_cmds_bitmask = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->cmds_bitmask = flow_ind->data.action.cmds_bitmask;
+      balIndCfg->flow_ind->data->action->has_o_vid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->o_vid = flow_ind->data.action.o_vid;
+      balIndCfg->flow_ind->data->action->has_o_pbits = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->o_pbits = flow_ind->data.action.o_pbits;
+      balIndCfg->flow_ind->data->action->has_o_tpid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->o_tpid = flow_ind->data.action.o_tpid;
+      balIndCfg->flow_ind->data->action->has_i_vid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->i_vid = flow_ind->data.action.i_vid;
+      balIndCfg->flow_ind->data->action->has_i_pbits = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->i_pbits = flow_ind->data.action.i_pbits;
+      balIndCfg->flow_ind->data->action->has_i_tpid = BAL_GRPC_PRES;
+      balIndCfg->flow_ind->data->action->i_tpid = flow_ind->data.action.i_tpid;
+
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -459,70 +501,79 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_GROUP_IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_GROUP_IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_group_ind *group_ind = (bcmbal_group_ind *)obj;
 
-      BalGroupInd groupInd;
-      memset(&groupInd, 0, sizeof(BalGroupInd));
-      bal_group_ind__init(&groupInd);
-      balIndCfg.group_ind = &groupInd;
+      BalGroupInd *groupInd;
+      groupInd = malloc(sizeof(BalGroupInd));
+      memset(groupInd, 0, sizeof(BalGroupInd));
+      bal_group_ind__init(groupInd);
+      balIndCfg->group_ind = groupInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.group_ind->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->group_ind->hdr = hdr;
 
-      BalGroupKey groupkey;
-      memset(&groupkey, 0, sizeof(BalGroupKey));
-      bal_group_key__init(&groupkey);
-      balIndCfg.group_ind->key = &groupkey;
+      BalGroupKey *groupkey;
+      groupkey = malloc(sizeof(BalGroupKey));
+      memset(groupkey, 0, sizeof(BalGroupKey));
+      bal_group_key__init(groupkey);
+      balIndCfg->group_ind->key = groupkey;
 
-      balIndCfg.group_ind->key->has_group_id = BAL_GRPC_PRES;
-      balIndCfg.group_ind->key->group_id = group_ind->key.group_id;
+      balIndCfg->group_ind->key->has_group_id = BAL_GRPC_PRES;
+      balIndCfg->group_ind->key->group_id = group_ind->key.group_id;
 
-      BalGroupIndData groupIndData;
-      memset(&groupIndData, 0, sizeof(BalGroupIndData));
-      bal_group_ind_data__init(&groupIndData);
-      balIndCfg.group_ind->data = &groupIndData;
+      BalGroupIndData *groupIndData;
+      groupIndData = malloc(sizeof(BalGroupIndData));
+      memset(groupIndData, 0, sizeof(BalGroupIndData));
+      bal_group_ind_data__init(groupIndData);
+      balIndCfg->group_ind->data = groupIndData;
 
-      balIndCfg.group_ind->data->has_members_cmd = BAL_GRPC_PRES;
-      balIndCfg.group_ind->data->members_cmd = group_ind->data.members_cmd;
-      balIndCfg.group_ind->data->has_cookie = BAL_GRPC_PRES;
-      balIndCfg.group_ind->data->cookie = group_ind->data.cookie;
-      balIndCfg.group_ind->data->has_owner = BAL_GRPC_PRES;
-      balIndCfg.group_ind->data->owner = group_ind->data.owner;
+      balIndCfg->group_ind->data->has_members_cmd = BAL_GRPC_PRES;
+      balIndCfg->group_ind->data->members_cmd = group_ind->data.members_cmd;
+      balIndCfg->group_ind->data->has_cookie = BAL_GRPC_PRES;
+      balIndCfg->group_ind->data->cookie = group_ind->data.cookie;
+      balIndCfg->group_ind->data->has_owner = BAL_GRPC_PRES;
+      balIndCfg->group_ind->data->owner = group_ind->data.owner;
 
-      BalGroupMemberInfoList balMembers;
-      memset(&balMembers, 0, sizeof(BalGroupMemberInfoList));
-      bal_group_member_info_list__init(&balMembers);
-      balIndCfg.group_ind->data->members = &balMembers;
+      BalGroupMemberInfoList *balMembers;
+      balMembers = malloc(sizeof(BalGroupMemberInfoList));
+      memset(balMembers, 0, sizeof(BalGroupMemberInfoList));
+      bal_group_member_info_list__init(balMembers);
+      balIndCfg->group_ind->data->members = balMembers;
 
-      balIndCfg.group_ind->data->members->n_val = group_ind->data.members.len;
+      balIndCfg->group_ind->data->members->n_val = group_ind->data.members.len;
 
       BalGroupMemberInfo *balMemberInfo;
-      balMemberInfo = (BalGroupMemberInfo *)malloc(sizeof(BalGroupMemberInfo));
-      memset(&balMemberInfo, 0, sizeof(BalGroupMemberInfo));
+      balMemberInfo = (BalGroupMemberInfo *)malloc(sizeof(BalGroupMemberInfo) * \
+                                         balIndCfg->group_ind->data->members->n_val);
+      memset(balMemberInfo, 0, sizeof(BalGroupMemberInfo) * \
+                                         balIndCfg->group_ind->data->members->n_val);
       bal_group_member_info__init(balMemberInfo);
-      balIndCfg.group_ind->data->members->val = &balMemberInfo;
+      balIndCfg->group_ind->data->members->val = balMemberInfo;
 
       balMemberInfo->has_intf_id = BAL_GRPC_PRES;
       balMemberInfo->intf_id = group_ind->data.members.val->intf_id;
       balMemberInfo->has_svc_port_id = BAL_GRPC_PRES;
       balMemberInfo->svc_port_id = group_ind->data.members.val->svc_port_id;
 
-      BalAction balAction;
-      memset(&balAction, 0, sizeof(BalAction));
-      bal_action__init(&balAction);
-      balMemberInfo->action = &balAction;
+      BalAction *balAction;
+      balAction = malloc(sizeof(BalAction));
+      memset(balAction, 0, sizeof(BalAction));
+      bal_action__init(balAction);
+      balMemberInfo->action = balAction;
 
       balMemberInfo->action->has_presence_mask = BAL_GRPC_PRES;
       balMemberInfo->action->presence_mask = group_ind->data.members.val->action.presence_mask;
@@ -541,29 +592,35 @@
       balMemberInfo->action->has_i_tpid = BAL_GRPC_PRES;
       balMemberInfo->action->i_tpid = group_ind->data.members.val->action.i_tpid;
 
-      BalTmQueueRef balQueue;
-      memset(&balQueue, 0, sizeof(BalTmQueueRef));
-      bal_tm_queue_ref__init(&balQueue);
-      balMemberInfo->queue = &balQueue;
+      BalTmQueueRef *balQueue;
+      balQueue = malloc(sizeof(BalTmQueueRef));
+      memset(balQueue, 0, sizeof(BalTmQueueRef));
+      bal_tm_queue_ref__init(balQueue);
+      balMemberInfo->queue = balQueue;
 
       balMemberInfo->queue->has_sched_id = BAL_GRPC_PRES;
       balMemberInfo->queue->sched_id = group_ind->data.members.val->queue.sched_id;
       balMemberInfo->queue->has_queue_id = BAL_GRPC_PRES;
       balMemberInfo->queue->queue_id = group_ind->data.members.val->queue.queue_id;
 
-      BalIdList balFlows;
-      memset(&balFlows, 0, sizeof(BalIdList));
-      bal_id_list__init(&balFlows);
-      balIndCfg.group_ind->data->flows = &balFlows;
+      BalIdList *balFlows;
+      balFlows = malloc(sizeof(BalIdList));
+      memset(balFlows, 0, sizeof(BalIdList));
+      bal_id_list__init(balFlows);
+      balIndCfg->group_ind->data->flows = balFlows;
 
-      balIndCfg.group_ind->data->flows->n_val =  group_ind->data.flows.len;
-      balIndCfg.group_ind->data->flows->val =
-           (uint32_t *)malloc((balIndCfg.group_ind->data->flows->n_val)*sizeof(uint32_t));
-      memcpy(balIndCfg.group_ind->data->flows->val, group_ind->data.flows.val,
-             balIndCfg.group_ind->data->flows->n_val);
+      balIndCfg->group_ind->data->flows->n_val =  group_ind->data.flows.len;
+      balIndCfg->group_ind->data->flows->val =
+           (uint32_t *)malloc((balIndCfg->group_ind->data->flows->n_val)*sizeof(uint32_t));
+      memcpy(balIndCfg->group_ind->data->flows->val, group_ind->data.flows.val,
+             balIndCfg->group_ind->data->flows->n_val);
 
-      BalErr *output;
-      result = bal_ind__bal_group_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -588,53 +645,62 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_OP_STATE;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_OP_STATE;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_interface_oper_status_change *int_osc_ind =
                                  (bcmbal_interface_oper_status_change *)obj;
 
-      BalInterfaceOperStatusChange ifOsc;
-      memset(&ifOsc, 0, sizeof(BalInterfaceOperStatusChange));
-      bal_interface_oper_status_change__init(&ifOsc);
-      balIndCfg.interface_op_state = &ifOsc;
+      BalInterfaceOperStatusChange *ifOsc;
+      ifOsc = malloc(sizeof(BalInterfaceOperStatusChange));
+      memset(ifOsc, 0, sizeof(BalInterfaceOperStatusChange));
+      bal_interface_oper_status_change__init(ifOsc);
+      balIndCfg->interface_op_state = ifOsc;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.interface_op_state->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->interface_op_state->hdr = hdr;
 
-      BalInterfaceKey ifkey;
-      memset(&ifkey, 0, sizeof(BalInterfaceKey));
-      bal_interface_key__init(&ifkey);
-      balIndCfg.interface_op_state->key = &ifkey;
+      BalInterfaceKey *ifkey;
+      ifkey = malloc(sizeof(BalInterfaceKey));
+      memset(ifkey, 0, sizeof(BalInterfaceKey));
+      bal_interface_key__init(ifkey);
+      balIndCfg->interface_op_state->key = ifkey;
 
-      balIndCfg.interface_op_state->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.interface_op_state->key->intf_id = int_osc_ind->key.intf_id;
-      balIndCfg.interface_op_state->key->has_intf_type = BAL_GRPC_PRES;
-      balIndCfg.interface_op_state->key->intf_type = int_osc_ind->key.intf_type;
+      balIndCfg->interface_op_state->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->interface_op_state->key->intf_id = int_osc_ind->key.intf_id;
+      balIndCfg->interface_op_state->key->has_intf_type = BAL_GRPC_PRES;
+      balIndCfg->interface_op_state->key->intf_type = int_osc_ind->key.intf_type;
 
-      BalInterfaceOperStatusChangeData ifOscIndData;
-      memset(&ifOscIndData, 0, sizeof(BalInterfaceOperStatusChangeData));
-      bal_interface_oper_status_change_data__init(&ifOscIndData);
-      balIndCfg.interface_op_state->data = &ifOscIndData;
+      BalInterfaceOperStatusChangeData *ifOscIndData;
+      ifOscIndData = malloc(sizeof(BalInterfaceOperStatusChangeData));
+      memset(ifOscIndData, 0, sizeof(BalInterfaceOperStatusChangeData));
+      bal_interface_oper_status_change_data__init(ifOscIndData);
+      balIndCfg->interface_op_state->data = ifOscIndData;
 
-      balIndCfg.interface_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
-      balIndCfg.interface_op_state->data->new_oper_status = int_osc_ind->data.new_oper_status;
-      balIndCfg.interface_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
-      balIndCfg.interface_op_state->data->old_oper_status = int_osc_ind->data.old_oper_status;
-      balIndCfg.interface_op_state->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.interface_op_state->data->admin_state = int_osc_ind->data.admin_state;
+      balIndCfg->interface_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
+      balIndCfg->interface_op_state->data->new_oper_status = int_osc_ind->data.new_oper_status;
+      balIndCfg->interface_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
+      balIndCfg->interface_op_state->data->old_oper_status = int_osc_ind->data.old_oper_status;
+      balIndCfg->interface_op_state->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->interface_op_state->data->admin_state = int_osc_ind->data.admin_state;
 
-      BalErr *output;
-      result = bal_ind__bal_iface_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -659,49 +725,58 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_LOS;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_LOS;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_interface_los *int_los_ind =
                                  (bcmbal_interface_los *)obj;
 
-      BalInterfaceLos ifLos;
-      memset(&ifLos, 0, sizeof(BalInterfaceLos));
-      bal_interface_los__init(&ifLos);
-      balIndCfg.interface_los = &ifLos;
+      BalInterfaceLos *ifLos;
+      ifLos = malloc(sizeof(BalInterfaceLos));
+      memset(ifLos, 0, sizeof(BalInterfaceLos));
+      bal_interface_los__init(ifLos);
+      balIndCfg->interface_los = ifLos;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.interface_los->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->interface_los->hdr = hdr;
 
-      BalInterfaceKey ifkey;
-      memset(&ifkey, 0, sizeof(BalInterfaceKey));
-      bal_interface_key__init(&ifkey);
-      balIndCfg.interface_los->key = &ifkey;
+      BalInterfaceKey *ifkey;
+      ifkey = malloc(sizeof(BalInterfaceKey));
+      memset(ifkey, 0, sizeof(BalInterfaceKey));
+      bal_interface_key__init(ifkey);
+      balIndCfg->interface_los->key = ifkey;
 
-      balIndCfg.interface_los->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.interface_los->key->intf_id = int_los_ind->key.intf_id;
-      balIndCfg.interface_los->key->has_intf_type = BAL_GRPC_PRES;
-      balIndCfg.interface_los->key->intf_type = int_los_ind->key.intf_type;
+      balIndCfg->interface_los->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->interface_los->key->intf_id = int_los_ind->key.intf_id;
+      balIndCfg->interface_los->key->has_intf_type = BAL_GRPC_PRES;
+      balIndCfg->interface_los->key->intf_type = int_los_ind->key.intf_type;
 
-      BalInterfaceLosData ifLosIndData;
-      memset(&ifLosIndData, 0, sizeof(BalInterfaceLosData));
-      bal_interface_los_data__init(&ifLosIndData);
-      balIndCfg.interface_los->data = &ifLosIndData;
+      BalInterfaceLosData *ifLosIndData;
+      ifLosIndData = malloc(sizeof(BalInterfaceLosData));
+      memset(ifLosIndData, 0, sizeof(BalInterfaceLosData));
+      bal_interface_los_data__init(ifLosIndData);
+      balIndCfg->interface_los->data = ifLosIndData;
 
-      balIndCfg.interface_los->data->has_status = BAL_GRPC_PRES;
-      balIndCfg.interface_los->data->status = int_los_ind->data.status;
+      balIndCfg->interface_los->data->has_status = BAL_GRPC_PRES;
+      balIndCfg->interface_los->data->status = int_los_ind->data.status;
 
-      BalErr *output;
-      result = bal_ind__bal_iface_los(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -726,77 +801,87 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_interface_ind *interface_ind = (bcmbal_interface_ind *)obj;
 
-      BalInterfaceInd ifInd;
-      memset(&ifInd, 0, sizeof(BalInterfaceInd));
-      bal_interface_ind__init(&ifInd);
-      balIndCfg.interface_ind = &ifInd;
+      BalInterfaceInd *ifInd;
+      ifInd = malloc(sizeof(BalInterfaceInd));
+      memset(ifInd, 0, sizeof(BalInterfaceInd));
+      bal_interface_ind__init(ifInd);
+      balIndCfg->interface_ind = ifInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.interface_ind->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->interface_ind->hdr = hdr;
 
-      BalInterfaceKey ifkey;
-      memset(&ifkey, 0, sizeof(BalInterfaceKey));
-      bal_interface_key__init(&ifkey);
-      balIndCfg.interface_ind->key = &ifkey;
+      BalInterfaceKey *ifkey;
+      ifkey = malloc(sizeof(BalInterfaceKey));
+      memset(ifkey, 0, sizeof(BalInterfaceKey));
+      bal_interface_key__init(ifkey);
+      balIndCfg->interface_ind->key = ifkey;
 
-      balIndCfg.interface_ind->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->key->intf_id = interface_ind->key.intf_id;
-      balIndCfg.interface_ind->key->has_intf_type = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->key->intf_type = interface_ind->key.intf_type;
+      balIndCfg->interface_ind->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->key->intf_id = interface_ind->key.intf_id;
+      balIndCfg->interface_ind->key->has_intf_type = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->key->intf_type = interface_ind->key.intf_type;
 
-      BalInterfaceIndData ifIndData;
-      memset(&ifIndData, 0, sizeof(BalInterfaceIndData));
-      bal_interface_ind_data__init(&ifIndData);
-      balIndCfg.interface_ind->data = &ifIndData;
+      BalInterfaceIndData *ifIndData;
+      ifIndData = malloc(sizeof(BalInterfaceIndData));
+      memset(ifIndData, 0, sizeof(BalInterfaceIndData));
+      bal_interface_ind_data__init(ifIndData);
+      balIndCfg->interface_ind->data = ifIndData;
 
-      balIndCfg.interface_ind->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->admin_state = interface_ind->data.admin_state;
-      balIndCfg.interface_ind->data->has_oper_status = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->oper_status = interface_ind->data.oper_status;
-      balIndCfg.interface_ind->data->has_min_data_agg_port_id = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->min_data_agg_port_id = interface_ind->data.min_data_agg_port_id;
-      balIndCfg.interface_ind->data->has_min_data_svc_port_id = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->min_data_svc_port_id = interface_ind->data.min_data_svc_port_id;
-      balIndCfg.interface_ind->data->has_transceiver_type = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->transceiver_type = interface_ind->data.transceiver_type;
-      balIndCfg.interface_ind->data->has_ds_miss_mode = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->ds_miss_mode = interface_ind->data.ds_miss_mode;
-      balIndCfg.interface_ind->data->has_mtu = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->mtu = interface_ind->data.mtu;
-      balIndCfg.interface_ind->data->has_flow_control = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->flow_control = interface_ind->data.flow_control;
-      balIndCfg.interface_ind->data->has_ds_tm = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->ds_tm = interface_ind->data.ds_tm;
-      balIndCfg.interface_ind->data->has_us_tm = BAL_GRPC_PRES;
-      balIndCfg.interface_ind->data->us_tm = interface_ind->data.us_tm;
+      balIndCfg->interface_ind->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->admin_state = interface_ind->data.admin_state;
+      balIndCfg->interface_ind->data->has_oper_status = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->oper_status = interface_ind->data.oper_status;
+      balIndCfg->interface_ind->data->has_min_data_agg_port_id = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->min_data_agg_port_id = interface_ind->data.min_data_agg_port_id;
+      balIndCfg->interface_ind->data->has_min_data_svc_port_id = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->min_data_svc_port_id = interface_ind->data.min_data_svc_port_id;
+      balIndCfg->interface_ind->data->has_transceiver_type = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->transceiver_type = interface_ind->data.transceiver_type;
+      balIndCfg->interface_ind->data->has_ds_miss_mode = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->ds_miss_mode = interface_ind->data.ds_miss_mode;
+      balIndCfg->interface_ind->data->has_mtu = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->mtu = interface_ind->data.mtu;
+      balIndCfg->interface_ind->data->has_flow_control = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->flow_control = interface_ind->data.flow_control;
+      balIndCfg->interface_ind->data->has_ds_tm = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->ds_tm = interface_ind->data.ds_tm;
+      balIndCfg->interface_ind->data->has_us_tm = BAL_GRPC_PRES;
+      balIndCfg->interface_ind->data->us_tm = interface_ind->data.us_tm;
 
-      BalIdList balFlows;
-      memset(&balFlows, 0, sizeof(BalIdList));
-      bal_id_list__init(&balFlows);
-      balIndCfg.interface_ind->data->sub_term_id_list = &balFlows;
+      BalIdList *balFlows;
+      balFlows = malloc(sizeof(BalIdList));
+      memset(balFlows, 0, sizeof(BalIdList));
+      bal_id_list__init(balFlows);
+      balIndCfg->interface_ind->data->sub_term_id_list = balFlows;
 
-      balIndCfg.interface_ind->data->sub_term_id_list->n_val =  interface_ind->data.sub_term_id_list.len;
-      balIndCfg.interface_ind->data->sub_term_id_list->val =
-           (uint32_t *)malloc((balIndCfg.interface_ind->data->sub_term_id_list->n_val)*sizeof(uint32_t));
-      memcpy(balIndCfg.interface_ind->data->sub_term_id_list->val, interface_ind->data.sub_term_id_list.val,
-             balIndCfg.interface_ind->data->sub_term_id_list->n_val);
+      balIndCfg->interface_ind->data->sub_term_id_list->n_val =  interface_ind->data.sub_term_id_list.len;
+      balIndCfg->interface_ind->data->sub_term_id_list->val =
+           (uint32_t *)malloc((balIndCfg->interface_ind->data->sub_term_id_list->n_val)*sizeof(uint32_t));
+      memcpy(balIndCfg->interface_ind->data->sub_term_id_list->val, interface_ind->data.sub_term_id_list.val,
+             balIndCfg->interface_ind->data->sub_term_id_list->n_val);
 
-      BalErr *output;
-      result = bal_ind__bal_iface_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -821,56 +906,65 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_OP_STATE;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_OP_STATE;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_subscriber_terminal_oper_status_change *sub_osc_ind =
                            (bcmbal_subscriber_terminal_oper_status_change *)obj;
 
-      BalSubscriberTerminalOperStatusChange subOscInd;
-      memset(&subOscInd, 0, sizeof(BalSubscriberTerminalOperStatusChange));
-      bal_subscriber_terminal_oper_status_change__init(&subOscInd);
-      balIndCfg.terminal_op_state = &subOscInd;
+      BalSubscriberTerminalOperStatusChange *subOscInd;
+      subOscInd = malloc(sizeof(BalSubscriberTerminalOperStatusChange));
+      memset(subOscInd, 0, sizeof(BalSubscriberTerminalOperStatusChange));
+      bal_subscriber_terminal_oper_status_change__init(subOscInd);
+      balIndCfg->terminal_op_state = subOscInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.terminal_op_state->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->terminal_op_state->hdr = hdr;
 
-      BalSubscriberTerminalKey subkey;
-      memset(&subkey, 0, sizeof(BalSubscriberTerminalKey));
-      bal_subscriber_terminal_key__init(&subkey);
-      balIndCfg.terminal_op_state->key = &subkey;
+      BalSubscriberTerminalKey *subkey;
+      subkey = malloc(sizeof(BalSubscriberTerminalKey));
+      memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+      bal_subscriber_terminal_key__init(subkey);
+      balIndCfg->terminal_op_state->key = subkey;
 
-      balIndCfg.terminal_op_state->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_op_state->key->intf_id = sub_osc_ind->key.intf_id;
-      balIndCfg.terminal_op_state->key->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_op_state->key->sub_term_id = sub_osc_ind->key.sub_term_id;
+      balIndCfg->terminal_op_state->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_op_state->key->intf_id = sub_osc_ind->key.intf_id;
+      balIndCfg->terminal_op_state->key->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_op_state->key->sub_term_id = sub_osc_ind->key.sub_term_id;
 
-      BalSubscriberTerminalOperStatusChangeData subOscIndData;
-      memset(&subOscIndData, 0, sizeof(BalSubscriberTerminalOperStatusChangeData));
-      bal_subscriber_terminal_oper_status_change_data__init(&subOscIndData);
-      balIndCfg.terminal_op_state->data = &subOscIndData;
+      BalSubscriberTerminalOperStatusChangeData *subOscIndData;
+      subOscIndData = malloc(sizeof(BalSubscriberTerminalOperStatusChangeData));
+      memset(subOscIndData, 0, sizeof(BalSubscriberTerminalOperStatusChangeData));
+      bal_subscriber_terminal_oper_status_change_data__init(subOscIndData);
+      balIndCfg->terminal_op_state->data = subOscIndData;
 
-      balIndCfg.terminal_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
-      balIndCfg.terminal_op_state->data->new_oper_status =
+      balIndCfg->terminal_op_state->data->has_new_oper_status = BAL_GRPC_PRES;
+      balIndCfg->terminal_op_state->data->new_oper_status =
                                            sub_osc_ind->data.new_oper_status;
-      balIndCfg.terminal_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
-      balIndCfg.terminal_op_state->data->old_oper_status =
+      balIndCfg->terminal_op_state->data->has_old_oper_status = BAL_GRPC_PRES;
+      balIndCfg->terminal_op_state->data->old_oper_status =
                                            sub_osc_ind->data.old_oper_status;
-      balIndCfg.terminal_op_state->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.terminal_op_state->data->admin_state =
+      balIndCfg->terminal_op_state->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->terminal_op_state->data->admin_state =
                                                sub_osc_ind->data.admin_state;
 
-      BalErr *output;
-      result = bal_ind__bal_subs_term_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -897,49 +991,55 @@
    {
       ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API \'%s\' IND callback (status is %s)\n",
 				  bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DISC;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DISC;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_subscriber_terminal_sub_term_disc *sub_disc_ind =
                            (bcmbal_subscriber_terminal_sub_term_disc *)obj;
 
-      BalSubscriberTerminalSubTermDisc subDiscInd;
-      memset(&subDiscInd, 0, sizeof(BalSubscriberTerminalSubTermDisc));
-      bal_subscriber_terminal_sub_term_disc__init(&subDiscInd);
-      balIndCfg.terminal_disc = &subDiscInd;
+      BalSubscriberTerminalSubTermDisc *subDiscInd;
+      subDiscInd = malloc(sizeof(BalSubscriberTerminalSubTermDisc));
+      memset(subDiscInd, 0, sizeof(BalSubscriberTerminalSubTermDisc));
+      bal_subscriber_terminal_sub_term_disc__init(subDiscInd);
+      balIndCfg->terminal_disc = subDiscInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.terminal_disc->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->terminal_disc->hdr = hdr;
 
-      BalSubscriberTerminalKey subkey;
-      memset(&subkey, 0, sizeof(BalSubscriberTerminalKey));
-      bal_subscriber_terminal_key__init(&subkey);
-      balIndCfg.terminal_disc->key = &subkey;
+      BalSubscriberTerminalKey *subkey;
+      subkey = malloc(sizeof(BalSubscriberTerminalKey));
+      memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+      bal_subscriber_terminal_key__init(subkey);
+      balIndCfg->terminal_disc->key = subkey;
 
-      balIndCfg.terminal_disc->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_disc->key->intf_id = sub_disc_ind->key.intf_id;
-      balIndCfg.terminal_disc->key->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_disc->key->sub_term_id = sub_disc_ind->key.sub_term_id;
+      balIndCfg->terminal_disc->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_disc->key->intf_id = sub_disc_ind->key.intf_id;
+      balIndCfg->terminal_disc->key->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_disc->key->sub_term_id = sub_disc_ind->key.sub_term_id;
 
-      BalSubscriberTerminalSubTermDiscData subDiscIndData;
-      memset(&subDiscIndData, 0, sizeof(BalSubscriberTerminalSubTermDiscData));
-      bal_subscriber_terminal_sub_term_disc_data__init(&subDiscIndData);
-      balIndCfg.terminal_disc->data = &subDiscIndData;
+      BalSubscriberTerminalSubTermDiscData *subDiscIndData;
+      subDiscIndData = malloc(sizeof(BalSubscriberTerminalSubTermDiscData));
+      memset(subDiscIndData, 0, sizeof(BalSubscriberTerminalSubTermDiscData));
+      bal_subscriber_terminal_sub_term_disc_data__init(subDiscIndData);
+      balIndCfg->terminal_disc->data = subDiscIndData;
 
-      BalSerialNumber serial_number;
-      memset(&serial_number, 0, sizeof(BalSerialNumber));
-      bal_serial_number__init(&serial_number);
+      BalSerialNumber *serial_number;
+      serial_number = malloc(sizeof(BalSerialNumber));
+      memset(serial_number, 0, sizeof(BalSerialNumber));
+      bal_serial_number__init(serial_number);
 
-      balIndCfg.terminal_disc->data->serial_number = &serial_number;
+      balIndCfg->terminal_disc->data->serial_number = serial_number;
 
       ASFVOLT_LOG(ASFVOLT_DEBUG, "Discovered ONU serial number "
                 "%2X%2X%2X%2X%1X%1X%1X%1X%1X%1X%1X%1X ",
@@ -959,17 +1059,17 @@
       ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor id is %s\n", sub_disc_ind->data.serial_number.vendor_id);
       ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor specific is %s\n", sub_disc_ind->data.serial_number.vendor_specific);
 
-      char vendor_id[MAX_CHAR_LENGTH];
-      memset(&vendor_id, 0, MAX_CHAR_LENGTH);
+      char *vendor_id = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+      memset(vendor_id, 0, MAX_CHAR_LENGTH);
       sprintf(vendor_id,"%c%c%c%c",
 		      sub_disc_ind->data.serial_number.vendor_id[0],
 		      sub_disc_ind->data.serial_number.vendor_id[1],
 		      sub_disc_ind->data.serial_number.vendor_id[2],
 		      sub_disc_ind->data.serial_number.vendor_id[3]);
-      balIndCfg.terminal_disc->data->serial_number->vendor_id = vendor_id;
-      ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor id is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_id);
-      char vendor_specific[MAX_CHAR_LENGTH];
-      memset(&vendor_specific, 0, MAX_CHAR_LENGTH);
+      balIndCfg->terminal_disc->data->serial_number->vendor_id = vendor_id;
+      ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor id is %s\n", balIndCfg->terminal_disc->data->serial_number->vendor_id);
+      char *vendor_specific = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+      memset(vendor_specific, 0, MAX_CHAR_LENGTH);
       sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X",
 		      sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f,
 		      sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f,
@@ -979,11 +1079,15 @@
 		      sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f,
 		      sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f,
 		      sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f);
-      balIndCfg.terminal_disc->data->serial_number->vendor_specific = vendor_specific;
-      ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor specific is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_specific);
+      balIndCfg->terminal_disc->data->serial_number->vendor_specific = vendor_specific;
+      ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor specific is %s\n", balIndCfg->terminal_disc->data->serial_number->vendor_specific);
 
-      BalErr *output;
-      result = bal_ind__bal_subs_term_discovery_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1008,61 +1112,70 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
-      balIndCfg.device_id = voltha_device_id;
-
-      balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_ALARM;
+      balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_ALARM;
       bcmbal_subscriber_terminal_sub_term_alarm *sub_term_alarm  =
                            (bcmbal_subscriber_terminal_sub_term_alarm *)obj;
 
-      BalSubscriberTerminalSubTermAlarm subTermAlarm;
-      memset(&subTermAlarm, 0, sizeof(BalSubscriberTerminalSubTermAlarm));
-      bal_subscriber_terminal_sub_term_alarm__init(&subTermAlarm);
-      balIndCfg.terminal_alarm = &subTermAlarm;
+      BalSubscriberTerminalSubTermAlarm *subTermAlarm;
+      subTermAlarm = malloc(sizeof(BalSubscriberTerminalSubTermAlarm));
+      memset(subTermAlarm, 0, sizeof(BalSubscriberTerminalSubTermAlarm));
+      bal_subscriber_terminal_sub_term_alarm__init(subTermAlarm);
+      balIndCfg->terminal_alarm = subTermAlarm;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.terminal_alarm->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->terminal_alarm->hdr = hdr;
 
-      BalSubscriberTerminalKey subkey;
-      memset(&subkey, 0, sizeof(BalSubscriberTerminalKey));
-      bal_subscriber_terminal_key__init(&subkey);
-      balIndCfg.terminal_alarm->key = &subkey;
+      BalSubscriberTerminalKey *subkey;
+      subkey = malloc(sizeof(BalSubscriberTerminalKey));
+      memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+      bal_subscriber_terminal_key__init(subkey);
+      balIndCfg->terminal_alarm->key = subkey;
 
-      balIndCfg.terminal_alarm->key->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->key->sub_term_id = sub_term_alarm->key.sub_term_id;
-      balIndCfg.terminal_alarm->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->key->intf_id = sub_term_alarm->key.intf_id;
+      balIndCfg->terminal_alarm->key->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->key->sub_term_id = sub_term_alarm->key.sub_term_id;
+      balIndCfg->terminal_alarm->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->key->intf_id = sub_term_alarm->key.intf_id;
 
-      BalsubscriberTerminalSubTermAlarmData subTermAlarmData;
-      memset(&subTermAlarmData, 0, sizeof(BalsubscriberTerminalSubTermAlarmData));
-      balsubscriber_terminal_sub_term_alarm_data__init(&subTermAlarmData);
-      balIndCfg.terminal_alarm->data = &subTermAlarmData;
+      BalsubscriberTerminalSubTermAlarmData *subTermAlarmData;
+      subTermAlarmData = malloc(sizeof(BalsubscriberTerminalSubTermAlarmData));
+      memset(subTermAlarmData, 0, sizeof(BalsubscriberTerminalSubTermAlarmData));
+      balsubscriber_terminal_sub_term_alarm_data__init(subTermAlarmData);
+      balIndCfg->terminal_alarm->data = subTermAlarmData;
 
-      BalSubscriberTerminalAlarms balSubAlarms;
-      memset(&balSubAlarms, 0, sizeof(BalSubscriberTerminalAlarms));
-      bal_subscriber_terminal_alarms__init(&balSubAlarms);
-      balIndCfg.terminal_alarm->data->alarm = &balSubAlarms;
+      BalSubscriberTerminalAlarms *balSubAlarms;
+      balSubAlarms = malloc(sizeof(BalSubscriberTerminalAlarms));
+      memset(balSubAlarms, 0, sizeof(BalSubscriberTerminalAlarms));
+      bal_subscriber_terminal_alarms__init(balSubAlarms);
+      balIndCfg->terminal_alarm->data->alarm = balSubAlarms;
 
-      balIndCfg.terminal_alarm->data->alarm->has_los = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->data->alarm->los = sub_term_alarm->data.alarm.los;
-      balIndCfg.terminal_alarm->data->alarm->has_lob = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->data->alarm->lob = sub_term_alarm->data.alarm.lob;
-      balIndCfg.terminal_alarm->data->alarm->has_lopc_miss = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->data->alarm->lopc_miss = sub_term_alarm->data.alarm.lopc_miss;
-      balIndCfg.terminal_alarm->data->alarm->has_lopc_mic_error = BAL_GRPC_PRES;
-      balIndCfg.terminal_alarm->data->alarm->lopc_mic_error = sub_term_alarm->data.alarm.lopc_mic_error;
+      balIndCfg->terminal_alarm->data->alarm->has_los = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->data->alarm->los = sub_term_alarm->data.alarm.los;
+      balIndCfg->terminal_alarm->data->alarm->has_lob = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->data->alarm->lob = sub_term_alarm->data.alarm.lob;
+      balIndCfg->terminal_alarm->data->alarm->has_lopc_miss = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->data->alarm->lopc_miss = sub_term_alarm->data.alarm.lopc_miss;
+      balIndCfg->terminal_alarm->data->alarm->has_lopc_mic_error = BAL_GRPC_PRES;
+      balIndCfg->terminal_alarm->data->alarm->lopc_mic_error = sub_term_alarm->data.alarm.lopc_mic_error;
 
-      BalErr *output;
-      result = bal_ind__bal_subs_term_alarm_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1087,49 +1200,58 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DGI;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DGI;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_subscriber_terminal_dgi *sub_dgi_ind =
                            (bcmbal_subscriber_terminal_dgi *)obj;
 
-      BalSubscriberTerminalDgi subDgiInd;
-      memset(&subDgiInd, 0, sizeof(BalSubscriberTerminalDgi));
-      bal_subscriber_terminal_dgi__init(&subDgiInd);
-      balIndCfg.terminal_dgi= &subDgiInd;
+      BalSubscriberTerminalDgi *subDgiInd;
+      subDgiInd = malloc(sizeof(BalSubscriberTerminalDgi));
+      memset(subDgiInd, 0, sizeof(BalSubscriberTerminalDgi));
+      bal_subscriber_terminal_dgi__init(subDgiInd);
+      balIndCfg->terminal_dgi= subDgiInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.terminal_dgi->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->terminal_dgi->hdr = hdr;
 
-      BalSubscriberTerminalKey subkey;
-      memset(&subkey, 0, sizeof(BalSubscriberTerminalKey));
-      bal_subscriber_terminal_key__init(&subkey);
-      balIndCfg.terminal_disc->key = &subkey;
+      BalSubscriberTerminalKey *subkey;
+      subkey = malloc(sizeof(BalSubscriberTerminalKey));
+      memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+      bal_subscriber_terminal_key__init(subkey);
+      balIndCfg->terminal_dgi->key = subkey;
 
-      balIndCfg.terminal_dgi->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_dgi->key->intf_id = sub_dgi_ind->key.intf_id;
-      balIndCfg.terminal_dgi->key->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_dgi->key->sub_term_id = sub_dgi_ind->key.sub_term_id;
+      balIndCfg->terminal_dgi->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_dgi->key->intf_id = sub_dgi_ind->key.intf_id;
+      balIndCfg->terminal_dgi->key->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_dgi->key->sub_term_id = sub_dgi_ind->key.sub_term_id;
 
-      BalSubscriberTerminalDgiData subDgiIndData;
-      memset(&subDgiIndData, 0, sizeof(BalSubscriberTerminalDgiData));
-      bal_subscriber_terminal_dgi_data__init(&subDgiIndData);
-      balIndCfg.terminal_dgi->data = &subDgiIndData;
+      BalSubscriberTerminalDgiData *subDgiIndData;
+      subDgiIndData = malloc(sizeof(BalSubscriberTerminalDgiData));
+      memset(subDgiIndData, 0, sizeof(BalSubscriberTerminalDgiData));
+      bal_subscriber_terminal_dgi_data__init(subDgiIndData);
+      balIndCfg->terminal_dgi->data = subDgiIndData;
 
-      balIndCfg.terminal_dgi->data->has_dgi_status = BAL_GRPC_PRES;
-      balIndCfg.terminal_dgi->data->dgi_status = sub_dgi_ind->data.dgi_status;
+      balIndCfg->terminal_dgi->data->has_dgi_status = BAL_GRPC_PRES;
+      balIndCfg->terminal_dgi->data->dgi_status = sub_dgi_ind->data.dgi_status;
 
-      BalErr *output;
-      result = bal_ind__bal_subs_term_dgi_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1154,93 +1276,99 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_subscriber_terminal_ind *sub_ind = (bcmbal_subscriber_terminal_ind *)obj;
 
-      BalSubscriberTerminalInd subInd;
-      memset(&subInd, 0, sizeof(BalSubscriberTerminalInd));
-      bal_subscriber_terminal_ind__init(&subInd);
-      balIndCfg.terminal_ind = &subInd;
+      BalSubscriberTerminalInd *subInd;
+      subInd = malloc(sizeof(BalSubscriberTerminalInd));
+      memset(subInd, 0, sizeof(BalSubscriberTerminalInd));
+      bal_subscriber_terminal_ind__init(subInd);
+      balIndCfg->terminal_ind = subInd;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.terminal_ind->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->terminal_ind->hdr = hdr;
 
-      BalSubscriberTerminalKey subkey;
-      memset(&subkey, 0, sizeof(BalSubscriberTerminalKey));
-      bal_subscriber_terminal_key__init(&subkey);
-      balIndCfg.terminal_ind->key = &subkey;
+      BalSubscriberTerminalKey *subkey;
+      subkey = malloc(sizeof(BalSubscriberTerminalKey));
+      memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+      bal_subscriber_terminal_key__init(subkey);
+      balIndCfg->terminal_ind->key = subkey;
 
-      balIndCfg.terminal_ind->key->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->key->intf_id = sub_ind->key.intf_id;
-      balIndCfg.terminal_ind->key->has_sub_term_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->key->sub_term_id = sub_ind->key.sub_term_id;
+      balIndCfg->terminal_ind->key->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->key->intf_id = sub_ind->key.intf_id;
+      balIndCfg->terminal_ind->key->has_sub_term_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->key->sub_term_id = sub_ind->key.sub_term_id;
 
-      BalSubscriberTerminalIndData subIndData;
-      memset(&subIndData, 0, sizeof(BalSubscriberTerminalIndData));
-      bal_subscriber_terminal_ind_data__init(&subIndData);
-      balIndCfg.terminal_ind->data = &subIndData;
+      BalSubscriberTerminalIndData *subIndData;
+      subIndData = malloc(sizeof(BalSubscriberTerminalIndData));
+      memset(subIndData, 0, sizeof(BalSubscriberTerminalIndData));
+      bal_subscriber_terminal_ind_data__init(subIndData);
+      balIndCfg->terminal_ind->data = subIndData;
 
-      balIndCfg.terminal_ind->data->has_admin_state = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->admin_state = sub_ind->data.admin_state;
-      balIndCfg.terminal_ind->data->has_oper_status = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->oper_status = sub_ind->data.oper_status;
-      balIndCfg.terminal_ind->data->has_svc_port_id = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->svc_port_id = sub_ind->data.svc_port_id;
-      balIndCfg.terminal_ind->data->has_ds_tm = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->ds_tm = sub_ind->data.ds_tm;
-      balIndCfg.terminal_ind->data->has_us_tm = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->us_tm = sub_ind->data.us_tm;
-      balIndCfg.terminal_ind->data->has_sub_term_rate = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->sub_term_rate = sub_ind->data.sub_term_rate;
-      char password[MAX_CHAR_LENGTH*2];
-      memset(&password, 0, MAX_CHAR_LENGTH*2);
+      balIndCfg->terminal_ind->data->has_admin_state = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->admin_state = sub_ind->data.admin_state;
+      balIndCfg->terminal_ind->data->has_oper_status = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->oper_status = sub_ind->data.oper_status;
+      balIndCfg->terminal_ind->data->has_svc_port_id = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->svc_port_id = sub_ind->data.svc_port_id;
+      balIndCfg->terminal_ind->data->has_ds_tm = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->ds_tm = sub_ind->data.ds_tm;
+      balIndCfg->terminal_ind->data->has_us_tm = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->us_tm = sub_ind->data.us_tm;
+      balIndCfg->terminal_ind->data->has_sub_term_rate = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->sub_term_rate = sub_ind->data.sub_term_rate;
+      char *password = malloc(sizeof(char)*MAX_CHAR_LENGTH*2);
+      memset(password, 0, MAX_CHAR_LENGTH*2);
       strcpy(password,(const char *)sub_ind->data.password.arr);
-      balIndCfg.terminal_ind->data->password = password;
-      char registration_id[MAX_CHAR_LENGTH*8];
-      memset(&registration_id, 0, MAX_CHAR_LENGTH*8);
+      balIndCfg->terminal_ind->data->password = password;
+      char *registration_id = malloc(sizeof(char)*MAX_CHAR_LENGTH*8);
+      memset(registration_id, 0, MAX_CHAR_LENGTH*8);
       strcpy(registration_id,(const char *)sub_ind->data.registration_id.arr);
-      balIndCfg.terminal_ind->data->registration_id =  registration_id;
+      balIndCfg->terminal_ind->data->registration_id =  registration_id;
 
 #if 0
-      balIndCfg.terminal_ind->data->has_mac_address = BAL_GRPC_PRES;
-      balIndCfg.terminal_ind->data->mac_address.len =
+      balIndCfg->terminal_ind->data->has_mac_address = BAL_GRPC_PRES;
+      balIndCfg->terminal_ind->data->mac_address.len =
                             (BCMOS_ETH_ALEN)*sizeof(sub_ind->data.mac_address.u8);
-      uint8_t mac_address[balIndCfg.terminal_ind->data->mac_address.len];
-      memset(&mac_address, 0 ,balIndCfg.terminal_ind->data->mac_address.len);
+      uint8_t mac_address[balIndCfg->terminal_ind->data->mac_address.len];
+      memset(&mac_address, 0 ,balIndCfg->terminal_ind->data->mac_address.len);
       strcpy((char *)mac_address,(const char *)sub_ind->data.mac_address.u8);
-      balIndCfg.terminal_ind->data->mac_address.data = mac_address;
+      balIndCfg->terminal_ind->data->mac_address.data = mac_address;
 #endif
 
-      BalSerialNumber serialNum;
-      memset(&serialNum, 0, sizeof(BalSerialNumber));
-      bal_serial_number__init(&serialNum);
-      balIndCfg.terminal_ind->data->serial_number = &serialNum;
+      BalSerialNumber *serialNum;
+      serialNum = malloc(sizeof(BalSerialNumber));
+      memset(serialNum, 0, sizeof(BalSerialNumber));
+      bal_serial_number__init(serialNum);
+      balIndCfg->terminal_ind->data->serial_number = serialNum;
 
       ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor id is %s\n", sub_ind->data.serial_number.vendor_id);
       ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor specific is %s\n", sub_ind->data.serial_number.vendor_specific);
 
-      char vendor_id[MAX_CHAR_LENGTH];
-      memset(&vendor_id, 0, MAX_CHAR_LENGTH);
+      char *vendor_id = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+      memset(vendor_id, 0, MAX_CHAR_LENGTH);
       sprintf(vendor_id,"%c%c%c%c",
 		      sub_ind->data.serial_number.vendor_id[0],
 		      sub_ind->data.serial_number.vendor_id[1],
 		      sub_ind->data.serial_number.vendor_id[2],
 		      sub_ind->data.serial_number.vendor_id[3]);
-      balIndCfg.terminal_ind->data->serial_number->vendor_id = vendor_id;
-      ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor id is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_id);
-      char vendor_specific[MAX_CHAR_LENGTH];
-      memset(&vendor_specific, 0, MAX_CHAR_LENGTH);
+      balIndCfg->terminal_ind->data->serial_number->vendor_id = vendor_id;
+      ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor id is %s\n", balIndCfg->terminal_ind->data->serial_number->vendor_id);
+      char *vendor_specific = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+      memset(vendor_specific, 0, MAX_CHAR_LENGTH);
       sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X",
 		      sub_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f,
 		      sub_ind->data.serial_number.vendor_specific[0] & 0x0f,
@@ -1250,24 +1378,29 @@
 		      sub_ind->data.serial_number.vendor_specific[2] & 0x0f,
 		      sub_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f,
 		      sub_ind->data.serial_number.vendor_specific[3] & 0x0f);
-      balIndCfg.terminal_ind->data->serial_number->vendor_specific = vendor_specific;
-      ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor specific is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_specific);
+      balIndCfg->terminal_ind->data->serial_number->vendor_specific = vendor_specific;
+      ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor specific is %s\n", balIndCfg->terminal_ind->data->serial_number->vendor_specific);
 
-      BalIdList balAggportList;
-      memset(&balAggportList, 0, sizeof(BalIdList));
-      bal_id_list__init(&balAggportList);
-      balIndCfg.terminal_ind->data->agg_port_id_list = &balAggportList;
+      BalIdList *balAggportList;
+      balAggportList = malloc(sizeof(BalIdList));
+      memset(balAggportList, 0, sizeof(BalIdList));
+      bal_id_list__init(balAggportList);
+      balIndCfg->terminal_ind->data->agg_port_id_list = balAggportList;
 
 #if 0
-      balIndCfg.terminal_ind->data->agg_port_id_list->n_val =  sub_ind->data.agg_port_id_list.len;
-      uint32_t agg_port_id_list[balIndCfg.terminal_ind->data->agg_port_id_list->n_val];
-      memset(&agg_port_id_list, 0, balIndCfg.terminal_ind->data->agg_port_id_list->n_val);
+      balIndCfg->terminal_ind->data->agg_port_id_list->n_val =  sub_ind->data.agg_port_id_list.len;
+      uint32_t agg_port_id_list[balIndCfg->terminal_ind->data->agg_port_id_list->n_val];
+      memset(&agg_port_id_list, 0, balIndCfg->terminal_ind->data->agg_port_id_list->n_val);
       strcpy((char *)agg_port_id_list,(const char *)sub_ind->data.agg_port_id_list.val);
-      balIndCfg.terminal_ind->data->agg_port_id_list->val = agg_port_id_list;
+      balIndCfg->terminal_ind->data->agg_port_id_list->val = agg_port_id_list;
 #endif
 
-      BalErr *output;
-      result = bal_ind__bal_subs_term_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1309,82 +1442,89 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TM_QUEUE__IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TM_QUEUE__IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_tm_queue_ind *tm_que_ind = (bcmbal_tm_queue_ind *)obj;
 
-      BalTmQueueInd tmQueInd;
-      memset(&tmQueInd, 0, sizeof(BalTmQueueInd));
-      bal_tm_queue_ind__init(&tmQueInd);
-      balIndCfg.tm_queue_ind = &tmQueInd;
+      BalTmQueueInd *tmQueInd;
+      tmQueInd = malloc(sizeof(BalTmQueueInd));
+      memset(tmQueInd, 0, sizeof(BalTmQueueInd));
+      bal_tm_queue_ind__init(tmQueInd);
+      balIndCfg->tm_queue_ind = tmQueInd;
 
-      BalTmQueueKey tmQkey;
-      memset(&tmQkey, 0, sizeof(BalTmQueueKey));
-      bal_tm_queue_key__init(&tmQkey);
-      balIndCfg.tm_queue_ind->key = &tmQkey;
+      BalTmQueueKey *tmQkey;
+      tmQkey = malloc(sizeof(BalTmQueueKey));
+      memset(tmQkey, 0, sizeof(BalTmQueueKey));
+      bal_tm_queue_key__init(tmQkey);
+      balIndCfg->tm_queue_ind->key = tmQkey;
 
-      balIndCfg.tm_queue_ind->key->has_sched_id = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->key->sched_id = tm_que_ind->key.sched_id;
-      balIndCfg.tm_queue_ind->key->has_sched_dir = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->key->sched_dir = tm_que_ind->key.sched_dir;
-      balIndCfg.tm_queue_ind->key->has_id = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->key->id = tm_que_ind->key.id;
+      balIndCfg->tm_queue_ind->key->has_sched_id = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->key->sched_id = tm_que_ind->key.sched_id;
+      balIndCfg->tm_queue_ind->key->has_sched_dir = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->key->sched_dir = tm_que_ind->key.sched_dir;
+      balIndCfg->tm_queue_ind->key->has_id = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->key->id = tm_que_ind->key.id;
 
-      BalTmQueueIndData tmQIndData;
-      memset(&tmQIndData, 0, sizeof(BalTmQueueIndData));
-      bal_tm_queue_ind_data__init(&tmQIndData);
-      balIndCfg.tm_queue_ind->data = &tmQIndData;
+      BalTmQueueIndData *tmQIndData;
+      tmQIndData = malloc(sizeof(BalTmQueueIndData));
+      memset(tmQIndData, 0, sizeof(BalTmQueueIndData));
+      bal_tm_queue_ind_data__init(tmQIndData);
+      balIndCfg->tm_queue_ind->data = tmQIndData;
 
-      balIndCfg.tm_queue_ind->data->has_priority = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->priority = tm_que_ind->data.priority;
-      balIndCfg.tm_queue_ind->data->has_weight = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->weight = tm_que_ind->data.weight;
-      balIndCfg.tm_queue_ind->data->has_create_mode = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->create_mode = tm_que_ind->data.create_mode;
-      balIndCfg.tm_queue_ind->data->has_ref_count = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->ref_count = tm_que_ind->data.ref_count;
+      balIndCfg->tm_queue_ind->data->has_priority = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->priority = tm_que_ind->data.priority;
+      balIndCfg->tm_queue_ind->data->has_weight = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->weight = tm_que_ind->data.weight;
+      balIndCfg->tm_queue_ind->data->has_create_mode = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->create_mode = tm_que_ind->data.create_mode;
+      balIndCfg->tm_queue_ind->data->has_ref_count = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->ref_count = tm_que_ind->data.ref_count;
 
-      BalTmShaping balShape;
-      memset(&balShape, 0, sizeof(BalTmShaping));
-      bal_tm_shaping__init(&balShape);
-      balIndCfg.tm_queue_ind->data->rate = &balShape;
+      BalTmShaping *balShape;
+      balShape = malloc(sizeof(BalTmShaping));
+      memset(balShape, 0, sizeof(BalTmShaping));
+      bal_tm_shaping__init(balShape);
+      balIndCfg->tm_queue_ind->data->rate = balShape;
 
-      balIndCfg.tm_queue_ind->data->rate->has_presence_mask = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->rate->presence_mask = tm_que_ind->data.rate.presence_mask;
-      balIndCfg.tm_queue_ind->data->rate->has_cir = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->rate->cir = tm_que_ind->data.rate.cir;
-      balIndCfg.tm_queue_ind->data->rate->has_pir = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->rate->pir = tm_que_ind->data.rate.pir;
-      balIndCfg.tm_queue_ind->data->rate->has_burst = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->rate->burst = tm_que_ind->data.rate.burst;
+      balIndCfg->tm_queue_ind->data->rate->has_presence_mask = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->rate->presence_mask = tm_que_ind->data.rate.presence_mask;
+      balIndCfg->tm_queue_ind->data->rate->has_cir = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->rate->cir = tm_que_ind->data.rate.cir;
+      balIndCfg->tm_queue_ind->data->rate->has_pir = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->rate->pir = tm_que_ind->data.rate.pir;
+      balIndCfg->tm_queue_ind->data->rate->has_burst = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->rate->burst = tm_que_ind->data.rate.burst;
 
-      BalTmBac balBac;
-      memset(&balBac, 0, sizeof(BalTmBac));
-      bal_tm_bac__init(&balBac);
-      balIndCfg.tm_queue_ind->data->bac = &balBac;
+      BalTmBac *balBac;
+      balBac = malloc(sizeof(BalTmBac));
+      memset(balBac, 0, sizeof(BalTmBac));
+      bal_tm_bac__init(balBac);
+      balIndCfg->tm_queue_ind->data->bac = balBac;
 
-      balIndCfg.tm_queue_ind->data->bac->has_type = BAL_GRPC_PRES;
-      balIndCfg.tm_queue_ind->data->bac->type = tm_que_ind->data.bac.type;
+      balIndCfg->tm_queue_ind->data->bac->has_type = BAL_GRPC_PRES;
+      balIndCfg->tm_queue_ind->data->bac->type = tm_que_ind->data.bac.type;
       switch(tm_que_ind->data.bac.type)
       {
          case BCMBAL_TM_BAC_TYPE_TAILDROP:
          {
-            balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_TAILDROP;
-            BalTMBacTaildrop balTaildrop;
-            memset(&balTaildrop, 0, sizeof(BalTMBacTaildrop));
-            bal_tmbac_taildrop__init(&balTaildrop);
-            balIndCfg.tm_queue_ind->data->bac->taildrop = &balTaildrop;
+            balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_TAILDROP;
+            BalTMBacTaildrop *balTaildrop;
+            balTaildrop = malloc(sizeof(BalTMBacTaildrop));
+            memset(balTaildrop, 0, sizeof(BalTMBacTaildrop));
+            bal_tmbac_taildrop__init(balTaildrop);
+            balIndCfg->tm_queue_ind->data->bac->taildrop = balTaildrop;
 
-            balIndCfg.tm_queue_ind->data->bac->taildrop->has_max_size = BAL_GRPC_PRES;
-            balIndCfg.tm_queue_ind->data->bac->taildrop->max_size =
+            balIndCfg->tm_queue_ind->data->bac->taildrop->has_max_size = BAL_GRPC_PRES;
+            balIndCfg->tm_queue_ind->data->bac->taildrop->max_size =
                                                tm_que_ind->data.bac.u.taildrop.max_size;
          }
          break;
@@ -1395,56 +1535,66 @@
          break;
          case BCMBAL_TM_BAC_TYPE_RED:
          {
-            balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_RED;
-            BalTMBacRed balBacRed;
-            memset(&balBacRed, 0, sizeof(BalTMBacRed));
-            bal_tmbac_red__init(&balBacRed);
-            balIndCfg.tm_queue_ind->data->bac->red = &balBacRed;
+            balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_RED;
+            BalTMBacRed *balBacRed;
+            balBacRed = malloc(sizeof(BalTMBacRed));
+            memset(balBacRed, 0, sizeof(BalTMBacRed));
+            bal_tmbac_red__init(balBacRed);
+            balIndCfg->tm_queue_ind->data->bac->red = balBacRed;
 
-            BalTmred balRed;
-            memset(&balRed, 0, sizeof(BalTmred));
-            bal_tmred__init(&balRed);
-            balIndCfg.tm_queue_ind->data->bac->red->red = &balRed;
-            fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->red->red, &tm_que_ind->data.bac.u.red.red);
+            BalTmred *balRed;
+            balRed = malloc(sizeof(BalTmred));
+            memset(balRed, 0, sizeof(BalTmred));
+            bal_tmred__init(balRed);
+            balIndCfg->tm_queue_ind->data->bac->red->red = balRed;
+            fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->red->red, &tm_que_ind->data.bac.u.red.red);
          }
          break;
          case BCMBAL_TM_BAC_TYPE_WRED:
          {
-            balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_WRED;
-            BalTMBacWred balBacWred;
-            memset(&balBacWred, 0, sizeof(BalTMBacWred));
-            bal_tmbac_wred__init(&balBacWred);
-            balIndCfg.tm_queue_ind->data->bac->wred = &balBacWred;
+            balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_WRED;
+            BalTMBacWred *balBacWred;
+            balBacWred = malloc(sizeof(BalTMBacWred));
+            memset(balBacWred, 0, sizeof(BalTMBacWred));
+            bal_tmbac_wred__init(balBacWred);
+            balIndCfg->tm_queue_ind->data->bac->wred = balBacWred;
 
-            BalTmred balGreen;
-            memset(&balGreen, 0, sizeof(BalTmred));
-            bal_tmred__init(&balGreen);
-            balIndCfg.tm_queue_ind->data->bac->wred->green = &balGreen;
-            fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->green, &tm_que_ind->data.bac.u.wred.green);
+            BalTmred *balGreen;
+            balGreen = malloc(sizeof(BalTmred));
+            memset(balGreen, 0, sizeof(BalTmred));
+            bal_tmred__init(balGreen);
+            balIndCfg->tm_queue_ind->data->bac->wred->green = balGreen;
+            fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->green, &tm_que_ind->data.bac.u.wred.green);
 
-            BalTmred balYellow;
-            memset(&balYellow, 0, sizeof(BalTmred));
-            bal_tmred__init(&balYellow);
-            balIndCfg.tm_queue_ind->data->bac->wred->yellow = &balYellow;
-            fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->yellow, &tm_que_ind->data.bac.u.wred.yellow);
+            BalTmred *balYellow;
+            balYellow = malloc(sizeof(BalTmred));
+            memset(balYellow, 0, sizeof(BalTmred));
+            bal_tmred__init(balYellow);
+            balIndCfg->tm_queue_ind->data->bac->wred->yellow = balYellow;
+            fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->yellow, &tm_que_ind->data.bac.u.wred.yellow);
 
-            BalTmred balRed;
-            memset(&balRed, 0, sizeof(BalTmred));
-            bal_tmred__init(&balRed);
-            balIndCfg.tm_queue_ind->data->bac->wred->red = &balRed;
-            fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->red, &tm_que_ind->data.bac.u.wred.red);
+            BalTmred *balRed;
+            balRed = malloc(sizeof(BalTmred));
+            memset(balRed, 0, sizeof(BalTmred));
+            bal_tmred__init(balRed);
+            balIndCfg->tm_queue_ind->data->bac->wred->red = balRed;
+            fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->red, &tm_que_ind->data.bac.u.wred.red);
          }
          break;
          default:
          {
-            balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U__NOT_SET;
+            balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U__NOT_SET;
          }
          break;
 
       }
 
-      BalErr *output;
-      result = bal_ind__bal_tm_queue_ind_info(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1469,41 +1619,49 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_TM_SCHED__IND;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_TM_SCHED__IND;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
       bcmbal_tm_sched_ind *tm_sched_ind = (bcmbal_tm_sched_ind *)obj;
 
-      BalTmSchedInd tmSchedInd;
-      memset(&tmSchedInd, 0, sizeof(BalTmSchedInd));
-      bal_tm_sched_ind__init(&tmSchedInd);
-      balIndCfg.tm_sched_ind = &tmSchedInd;
+      BalTmSchedInd *tmSchedInd;
+      tmSchedInd = malloc(sizeof(BalTmSchedInd));
+      memset(tmSchedInd, 0, sizeof(BalTmSchedInd));
+      bal_tm_sched_ind__init(tmSchedInd);
+      balIndCfg->tm_sched_ind = tmSchedInd;
 
-      BalTmSchedKey tmSchedkey;
-      memset(&tmSchedkey, 0, sizeof(BalTmSchedKey));
-      bal_tm_sched_key__init(&tmSchedkey);
-      balIndCfg.tm_sched_ind->key = &tmSchedkey;
+      BalTmSchedKey *tmSchedkey;
+      tmSchedkey = malloc(sizeof(BalTmSchedKey));
+      memset(tmSchedkey, 0, sizeof(BalTmSchedKey));
+      bal_tm_sched_key__init(tmSchedkey);
+      balIndCfg->tm_sched_ind->key = tmSchedkey;
 
-      balIndCfg.tm_sched_ind->key->has_dir = BAL_GRPC_PRES;
-      balIndCfg.tm_sched_ind->key->dir = tm_sched_ind->key.dir;
-      balIndCfg.tm_sched_ind->key->has_id = BAL_GRPC_PRES;
-      balIndCfg.tm_sched_ind->key->id = tm_sched_ind->key.id;
+      balIndCfg->tm_sched_ind->key->has_dir = BAL_GRPC_PRES;
+      balIndCfg->tm_sched_ind->key->dir = tm_sched_ind->key.dir;
+      balIndCfg->tm_sched_ind->key->has_id = BAL_GRPC_PRES;
+      balIndCfg->tm_sched_ind->key->id = tm_sched_ind->key.id;
 
-      BalTmSchedIndData tmSIndData;
-      memset(&tmSIndData, 0, sizeof(BalTmSchedIndData));
-      bal_tm_sched_ind_data__init(&tmSIndData);
-      balIndCfg.tm_sched_ind->data = &tmSIndData;
+      BalTmSchedIndData *tmSIndData;
+      tmSIndData = malloc(sizeof(BalTmSchedIndData));
+      memset(tmSIndData, 0, sizeof(BalTmSchedIndData));
+      bal_tm_sched_ind_data__init(tmSIndData);
+      balIndCfg->tm_sched_ind->data = tmSIndData;
       /* TODO: data should be populate */
 
-      BalErr *output;
-      result = bal_ind__bal_tm_sched_ind_info(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1530,130 +1688,143 @@
    {
       /*bcmos_mutex_lock(&bal_ind_lock);-- Need to define bcm independent mutex*/
 
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_PKT_DATA;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_PKT_DATA;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
-      BalPacketBearerChannelRx rxChannel;
-      memset(&rxChannel, 0, sizeof(BalPacketBearerChannelRx));
-      bal_packet_bearer_channel_rx__init(&rxChannel);
-      balIndCfg.pktdata = &rxChannel;
+      BalPacketBearerChannelRx *rxChannel;
+      rxChannel = malloc(sizeof(BalPacketBearerChannelRx));
+      memset(rxChannel, 0, sizeof(BalPacketBearerChannelRx));
+      bal_packet_bearer_channel_rx__init(rxChannel);
+      balIndCfg->pktdata = rxChannel;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.pktdata->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->pktdata->hdr = hdr;
 
-      BalPacketKey packetkey;
-      memset(&packetkey, 0, sizeof(BalPacketKey));
-      bal_packet_key__init(&packetkey);
-      balIndCfg.pktdata->key = &packetkey;
+      BalPacketKey *packetkey;
+      packetkey = malloc(sizeof(BalPacketKey));
+      memset(packetkey, 0, sizeof(BalPacketKey));
+      bal_packet_key__init(packetkey);
+      balIndCfg->pktdata->key = packetkey;
 
       bcmbal_packet_bearer_channel_rx *rx_channel =
                                   (bcmbal_packet_bearer_channel_rx *)obj;
 
-      balIndCfg.pktdata->key->has_reserved = BAL_GRPC_PRES;
-      balIndCfg.pktdata->key->reserved = rx_channel->key.reserved;
+      balIndCfg->pktdata->key->has_reserved = BAL_GRPC_PRES;
+      balIndCfg->pktdata->key->reserved = rx_channel->key.reserved;
 
-      BalDest PktSndDest;
-      memset(&PktSndDest, 0, sizeof(BalDest));
-      bal_dest__init(&PktSndDest);
-      balIndCfg.pktdata->key->packet_send_dest = &PktSndDest;
+      BalDest *PktSndDest;
+      PktSndDest = malloc(sizeof(BalDest));
+      memset(PktSndDest, 0, sizeof(BalDest));
+      bal_dest__init(PktSndDest);
+      balIndCfg->pktdata->key->packet_send_dest = PktSndDest;
 
-      balIndCfg.pktdata->key->packet_send_dest->has_type = BAL_GRPC_PRES;
-      balIndCfg.pktdata->key->packet_send_dest->type =
+      balIndCfg->pktdata->key->packet_send_dest->has_type = BAL_GRPC_PRES;
+      balIndCfg->pktdata->key->packet_send_dest->type =
                                           rx_channel->key.packet_send_dest.type;
       switch( rx_channel->key.packet_send_dest.type)
       {
          case BCMBAL_DEST_TYPE_NNI:
          {
-            balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_NNI;
-            BalDestNni balNni;
-            memset(&balNni, 0, sizeof(BalDestNni));
-            bal_dest_nni__init(&balNni);
-            balIndCfg.pktdata->key->packet_send_dest->nni = &balNni;
-            balIndCfg.pktdata->key->packet_send_dest->nni->has_intf_id = BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->nni->intf_id =
+            balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_NNI;
+            BalDestNni *balNni;
+            balNni = malloc(sizeof(BalDestNni));
+            memset(balNni, 0, sizeof(BalDestNni));
+            bal_dest_nni__init(balNni);
+            balIndCfg->pktdata->key->packet_send_dest->nni = balNni;
+            balIndCfg->pktdata->key->packet_send_dest->nni->has_intf_id = BAL_GRPC_PRES;
+            balIndCfg->pktdata->key->packet_send_dest->nni->intf_id =
                                           rx_channel->key.packet_send_dest.u.nni.intf_id;
          }
          break;
          case BCMBAL_DEST_TYPE_SUB_TERM:
          {
-            balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SUB_TERM;
-            BalDestSubTerm balSubTerm;
-            memset(&balSubTerm, 0, sizeof(BalDestSubTerm));
-            bal_dest_sub_term__init(&balSubTerm);
-            balIndCfg.pktdata->key->packet_send_dest->sub_term = &balSubTerm;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_id =
+            balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SUB_TERM;
+            BalDestSubTerm *balSubTerm;
+            balSubTerm = malloc(sizeof(BalDestSubTerm));
+            memset(balSubTerm, 0, sizeof(BalDestSubTerm));
+            bal_dest_sub_term__init(balSubTerm);
+            balIndCfg->pktdata->key->packet_send_dest->sub_term = balSubTerm;
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->has_sub_term_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_id =
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->sub_term_id =
                                  rx_channel->key.packet_send_dest.u.sub_term.sub_term_id;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_uni =
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->has_sub_term_uni =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_uni =
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->sub_term_uni =
                                 rx_channel->key.packet_send_dest.u.sub_term.sub_term_uni;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->has_intf_id =
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->has_intf_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->sub_term->intf_id =
+            balIndCfg->pktdata->key->packet_send_dest->sub_term->intf_id =
                                       rx_channel->key.packet_send_dest.u.sub_term.intf_id;
          }
          break;
          case BCMBAL_DEST_TYPE_SVC_PORT:
          {
-            balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SVC_PORT;
-            BalDestSvcPort balSvcPort;
-            memset(&balSvcPort, 0, sizeof(BalDestSvcPort));
-            bal_dest_svc_port__init(&balSvcPort);
-            balIndCfg.pktdata->key->packet_send_dest->svc_port = &balSvcPort;
-            balIndCfg.pktdata->key->packet_send_dest->svc_port->has_svc_port_id =
+            balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SVC_PORT;
+            BalDestSvcPort *balSvcPort;
+            balSvcPort = malloc(sizeof(BalDestSvcPort));
+            memset(balSvcPort, 0, sizeof(BalDestSvcPort));
+            bal_dest_svc_port__init(balSvcPort);
+            balIndCfg->pktdata->key->packet_send_dest->svc_port = balSvcPort;
+            balIndCfg->pktdata->key->packet_send_dest->svc_port->has_svc_port_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->svc_port->svc_port_id =
+            balIndCfg->pktdata->key->packet_send_dest->svc_port->svc_port_id =
                                  rx_channel->key.packet_send_dest.u.svc_port.svc_port_id;
-            balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id =
+            balIndCfg->pktdata->key->packet_send_dest->svc_port->has_intf_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id =
+            balIndCfg->pktdata->key->packet_send_dest->svc_port->has_intf_id =
                                       rx_channel->key.packet_send_dest.u.svc_port.intf_id;
          }
          break;
          default:
          {
-            balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
+            balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
          }
          break;
       }
 
-      BalPacketBearerChannelRxData pkdData;
-      memset(&pkdData, 0, sizeof(BalPacketBearerChannelRxData));
-      bal_packet_bearer_channel_rx_data__init(&pkdData);
-      balIndCfg.pktdata->data = &pkdData;
+      BalPacketBearerChannelRxData *pkdData;
+      pkdData = malloc(sizeof(BalPacketBearerChannelRxData));
+      memset(pkdData, 0, sizeof(BalPacketBearerChannelRxData));
+      bal_packet_bearer_channel_rx_data__init(pkdData);
+      balIndCfg->pktdata->data = pkdData;
 
-      balIndCfg.pktdata->data->has_flow_id = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->flow_id = rx_channel->data.flow_id;
-      balIndCfg.pktdata->data->has_flow_type = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->flow_type = rx_channel->data.flow_type;
-      balIndCfg.pktdata->data->has_intf_id = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->intf_id = rx_channel->data.intf_id;
-      balIndCfg.pktdata->data->has_intf_type = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->intf_type = rx_channel->data.intf_type;
-      balIndCfg.pktdata->data->has_svc_port = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->svc_port = rx_channel->data.svc_port;
-      balIndCfg.pktdata->data->has_flow_cookie = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->flow_cookie = rx_channel->data.flow_cookie;
-      balIndCfg.pktdata->data->has_pkt = BAL_GRPC_PRES;
-      balIndCfg.pktdata->data->pkt.len = rx_channel->data.pkt.len;
-      balIndCfg.pktdata->data->pkt.data = (uint8_t *)malloc((balIndCfg.pktdata->data->pkt.len)*sizeof(uint8_t));
-      memcpy(balIndCfg.pktdata->data->pkt.data,  rx_channel->data.pkt.val, balIndCfg.pktdata->data->pkt.len);
+      balIndCfg->pktdata->data->has_flow_id = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->flow_id = rx_channel->data.flow_id;
+      balIndCfg->pktdata->data->has_flow_type = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->flow_type = rx_channel->data.flow_type;
+      balIndCfg->pktdata->data->has_intf_id = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->intf_id = rx_channel->data.intf_id;
+      balIndCfg->pktdata->data->has_intf_type = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->intf_type = rx_channel->data.intf_type;
+      balIndCfg->pktdata->data->has_svc_port = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->svc_port = rx_channel->data.svc_port;
+      balIndCfg->pktdata->data->has_flow_cookie = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->flow_cookie = rx_channel->data.flow_cookie;
+      balIndCfg->pktdata->data->has_pkt = BAL_GRPC_PRES;
+      balIndCfg->pktdata->data->pkt.len = rx_channel->data.pkt.len;
+      balIndCfg->pktdata->data->pkt.data = (uint8_t *)malloc((balIndCfg->pktdata->data->pkt.len)*sizeof(uint8_t));
+      memcpy(balIndCfg->pktdata->data->pkt.data,  rx_channel->data.pkt.val, balIndCfg->pktdata->data->pkt.len);
 
       /*bcmos_mutex_unlock(&bal_ind_lock);-- Need to define bcm independent mutex*/
 
-      BalErr *output;
-      result = bal_ind__bal_pkt_bearer_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1679,95 +1850,106 @@
    else
    {
       ASFVOLT_LOG(ASFVOLT_DEBUG, "Received OMCI response via BAL APIs\n");
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OMCI_RESP;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_BAL_OMCI_RESP;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
-      BalPacketItuOmciChannelRx omciChannel;
-      memset(&omciChannel, 0, sizeof(BalPacketItuOmciChannelRx));
-      bal_packet_itu_omci_channel_rx__init(&omciChannel);
-      balIndCfg.balomciresp = &omciChannel;
+      BalPacketItuOmciChannelRx *omciChannel;
+      omciChannel = malloc(sizeof(BalPacketItuOmciChannelRx));
+      memset(omciChannel, 0, sizeof(BalPacketItuOmciChannelRx));
+      bal_packet_itu_omci_channel_rx__init(omciChannel);
+      balIndCfg->balomciresp = omciChannel;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.balomciresp->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->balomciresp->hdr = hdr;
 
-      BalPacketKey packetkey;
-      memset(&packetkey, 0, sizeof(BalPacketKey));
-      bal_packet_key__init(&packetkey);
-      balIndCfg.balomciresp->key = &packetkey;
+      BalPacketKey *packetkey;
+      packetkey = malloc(sizeof(BalPacketKey));
+      memset(packetkey, 0, sizeof(BalPacketKey));
+      bal_packet_key__init(packetkey);
+      balIndCfg->balomciresp->key = packetkey;
 
-      BalPacketItuOmciChannelRxData omciData;
-      memset(&omciData, 0, sizeof(BalPacketItuOmciChannelRxData));
-      bal_packet_itu_omci_channel_rx_data__init(&omciData);
-      balIndCfg.balomciresp->data = &omciData;
+      BalPacketItuOmciChannelRxData *omciData;
+      omciData = malloc(sizeof(BalPacketItuOmciChannelRxData));
+      memset(omciData, 0, sizeof(BalPacketItuOmciChannelRxData));
+      bal_packet_itu_omci_channel_rx_data__init(omciData);
+      balIndCfg->balomciresp->data = omciData;
 
       bcmbal_packet_itu_omci_channel_rx *omci_channel =
                                   (bcmbal_packet_itu_omci_channel_rx *)obj;
 
-      balIndCfg.balomciresp->data->has_pkt =  BAL_GRPC_PRES;
-      balIndCfg.balomciresp->data->pkt.len =  omci_channel->data.pkt.len;
-      balIndCfg.balomciresp->data->pkt.data = (uint8_t *)malloc((omci_channel->data.pkt.len)*sizeof(uint8_t));
-      memcpy(balIndCfg.balomciresp->data->pkt.data, omci_channel->data.pkt.val,
-             balIndCfg.balomciresp->data->pkt.len);
+      balIndCfg->balomciresp->data->has_pkt =  BAL_GRPC_PRES;
+      balIndCfg->balomciresp->data->pkt.len =  omci_channel->data.pkt.len;
+      balIndCfg->balomciresp->data->pkt.data = (uint8_t *)malloc((omci_channel->data.pkt.len)*sizeof(uint8_t));
+      memcpy(balIndCfg->balomciresp->data->pkt.data, omci_channel->data.pkt.val,
+             balIndCfg->balomciresp->data->pkt.len);
 
-      balIndCfg.balomciresp->key->has_reserved = BAL_GRPC_PRES;
-      balIndCfg.balomciresp->key->reserved = omci_channel->key.reserved;
+      balIndCfg->balomciresp->key->has_reserved = BAL_GRPC_PRES;
+      balIndCfg->balomciresp->key->reserved = omci_channel->key.reserved;
 
-      BalDest PktSndDest;
-      memset(&PktSndDest, 0, sizeof(BalDest));
-      bal_dest__init(&PktSndDest);
-      balIndCfg.balomciresp->key->packet_send_dest = &PktSndDest;
+      BalDest *PktSndDest;
+      PktSndDest = malloc(sizeof(BalDest));
+      memset(PktSndDest, 0, sizeof(BalDest));
+      bal_dest__init(PktSndDest);
+      balIndCfg->balomciresp->key->packet_send_dest = PktSndDest;
 
-      balIndCfg.balomciresp->key->packet_send_dest->has_type = BAL_GRPC_PRES;
-      balIndCfg.balomciresp->key->packet_send_dest->type =
+      balIndCfg->balomciresp->key->packet_send_dest->has_type = BAL_GRPC_PRES;
+      balIndCfg->balomciresp->key->packet_send_dest->type =
                                           omci_channel->key.packet_send_dest.type;
       switch( omci_channel->key.packet_send_dest.type)
       {
          case BCMBAL_DEST_TYPE_ITU_OMCI_CHANNEL:
          {
-            balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U_ITU_OMCI_CHANNEL;
-            BalItuOmciChannel balOmci;
-            memset(&balOmci, 0, sizeof(BalItuOmciChannel));
-            bal_itu_omci_channel__init(&balOmci);
-            balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel = &balOmci;
-            balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->has_sub_term_id =
+            balIndCfg->balomciresp->key->packet_send_dest->u_case = BAL_DEST__U_ITU_OMCI_CHANNEL;
+            BalItuOmciChannel *balOmci;
+            balOmci = malloc(sizeof(BalItuOmciChannel));
+            memset(balOmci, 0, sizeof(BalItuOmciChannel));
+            bal_itu_omci_channel__init(balOmci);
+            balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel = balOmci;
+            balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->has_sub_term_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id =
+            balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id =
                             omci_channel->key.packet_send_dest.u.itu_omci_channel.sub_term_id;
-            balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->has_intf_id =
+            balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->has_intf_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->intf_id =
+            balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->intf_id =
                                  omci_channel->key.packet_send_dest.u.itu_omci_channel.intf_id;
             ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n",
-                 balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id);
+                 balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id);
          }
          break;
          default:
          {
-            balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
+            balIndCfg->balomciresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
          }
          break;
       }
 
-      ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is \n",balIndCfg.balomciresp->data->pkt.len);
+      ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is \n",balIndCfg->balomciresp->data->pkt.len);
       uint16_t idx;
-      for(idx=0; idx<balIndCfg.balomciresp->data->pkt.len; idx++)
+      for(idx=0; idx<balIndCfg->balomciresp->data->pkt.len; idx++)
       {
-	      printf("%02x", balIndCfg.balomciresp->data->pkt.data[idx]);
+	      printf("%02x", balIndCfg->balomciresp->data->pkt.data[idx]);
       }
       printf("\n");
       ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n",
-		      balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id);
-      BalErr *output;
-      result = bal_ind__bal_pkt_omci_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+		      balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
+
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
@@ -1792,89 +1974,99 @@
    }
    else
    {
-      BalIndications balIndCfg;
-      memset(&balIndCfg, 0, sizeof(BalIndications));
-      bal_indications__init(&balIndCfg);
-      balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OAM_RESP;
-      balIndCfg.has_objtype = BAL_GRPC_PRES;
-      balIndCfg.objtype = obj->obj_type;
-      balIndCfg.has_sub_group = BAL_GRPC_PRES;
-      balIndCfg.sub_group = obj->subgroup;
-      balIndCfg.device_id = voltha_device_id;
+      BalIndications *balIndCfg;
+      balIndCfg = malloc(sizeof(BalIndications));
+      memset(balIndCfg, 0, sizeof(BalIndications));
+      bal_indications__init(balIndCfg);
+      balIndCfg->u_case = BAL_INDICATIONS__U_BAL_OAM_RESP;
+      balIndCfg->has_objtype = BAL_GRPC_PRES;
+      balIndCfg->objtype = obj->obj_type;
+      balIndCfg->has_sub_group = BAL_GRPC_PRES;
+      balIndCfg->sub_group = obj->subgroup;
+      balIndCfg->device_id = voltha_device_id;
 
-      BalPacketIeeeOamChannelRx oamChannel;
-      memset(&oamChannel, 0, sizeof(BalPacketIeeeOamChannelRx));
-      bal_packet_ieee_oam_channel_rx__init(&oamChannel);
-      balIndCfg.baloamresp = &oamChannel;
+      BalPacketIeeeOamChannelRx *oamChannel;
+      oamChannel = malloc(sizeof(BalPacketIeeeOamChannelRx));
+      memset(oamChannel, 0, sizeof(BalPacketIeeeOamChannelRx));
+      bal_packet_ieee_oam_channel_rx__init(oamChannel);
+      balIndCfg->baloamresp = oamChannel;
 
-      BalObj hdr;
-      memset(&hdr, 0, sizeof(BalObj));
-      bal_obj__init(&hdr);
-      balIndCfg.baloamresp->hdr = &hdr;
+      BalObj *hdr;
+      hdr = malloc(sizeof(BalObj));
+      memset(hdr, 0, sizeof(BalObj));
+      bal_obj__init(hdr);
+      balIndCfg->baloamresp->hdr = hdr;
 
-      BalPacketKey packetkey;
-      memset(&packetkey, 0, sizeof(BalPacketKey));
-      bal_packet_key__init(&packetkey);
-      balIndCfg.baloamresp->key = &packetkey;
+      BalPacketKey *packetkey;
+      packetkey = malloc(sizeof(BalPacketKey));
+      memset(packetkey, 0, sizeof(BalPacketKey));
+      bal_packet_key__init(packetkey);
+      balIndCfg->baloamresp->key = packetkey;
 
       bcmbal_packet_ieee_oam_channel_rx *oam_channel =
                                   (bcmbal_packet_ieee_oam_channel_rx *)obj;
 
-      balIndCfg.baloamresp->key->has_reserved = BAL_GRPC_PRES;
-      balIndCfg.baloamresp->key->reserved = oam_channel->key.reserved;
+      balIndCfg->baloamresp->key->has_reserved = BAL_GRPC_PRES;
+      balIndCfg->baloamresp->key->reserved = oam_channel->key.reserved;
 
-      BalDest PktSndDest;
-      memset(&PktSndDest, 0, sizeof(BalDest));
-      bal_dest__init(&PktSndDest);
-      balIndCfg.baloamresp->key->packet_send_dest = &PktSndDest;
+      BalDest *PktSndDest;
+      PktSndDest = malloc(sizeof(BalDest));
+      memset(PktSndDest, 0, sizeof(BalDest));
+      bal_dest__init(PktSndDest);
+      balIndCfg->baloamresp->key->packet_send_dest = PktSndDest;
 
-      balIndCfg.baloamresp->key->packet_send_dest->has_type = BAL_GRPC_PRES;
-      balIndCfg.baloamresp->key->packet_send_dest->type =
+      balIndCfg->baloamresp->key->packet_send_dest->has_type = BAL_GRPC_PRES;
+      balIndCfg->baloamresp->key->packet_send_dest->type =
                                           oam_channel->key.packet_send_dest.type;
       switch( oam_channel->key.packet_send_dest.type)
       {
          case BCMBAL_DEST_TYPE_IEEE_OAM_CHANNEL:
          {
-            balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U_IEEE_OAM_CHANNEL;
-            BalIeeeOamChannel balOam;
-            memset(&balOam, 0, sizeof(BalIeeeOamChannel));
-            bal_ieee_oam_channel__init(&balOam);
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel = &balOam;
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_intf_id =
+            balIndCfg->baloamresp->key->packet_send_dest->u_case = BAL_DEST__U_IEEE_OAM_CHANNEL;
+            BalIeeeOamChannel *balOam;
+            balOam = malloc(sizeof(BalIeeeOamChannel));
+            memset(balOam, 0, sizeof(BalIeeeOamChannel));
+            bal_ieee_oam_channel__init(balOam);
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel = balOam;
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->has_intf_id =
                                                                             BAL_GRPC_PRES;
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->intf_id =
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->intf_id =
                                  oam_channel->key.packet_send_dest.u.ieee_oam_channel.intf_id;
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_mac_address = BAL_GRPC_PRES;
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len =
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->has_mac_address = BAL_GRPC_PRES;
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len =
                (BCMOS_ETH_ALEN)*sizeof(oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8);
-            balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data =
-             (uint8_t *)malloc((balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len)*sizeof(uint8_t));
-            memcpy(balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data,
+            balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data =
+             (uint8_t *)malloc((balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len)*sizeof(uint8_t));
+            memcpy(balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data,
                    oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8,
-                   balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len);
+                   balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len);
 
          }
          break;
          default:
          {
-            balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
+            balIndCfg->baloamresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET;
          }
          break;
       }
 
-      BalPacketIeeeOamChannelRxData oamData;
-      memset(&oamData, 0, sizeof(BalPacketIeeeOamChannelRxData));
-      bal_packet_ieee_oam_channel_rx_data__init(&oamData);
-      balIndCfg.baloamresp->data = &oamData;
+      BalPacketIeeeOamChannelRxData *oamData;
+      oamData = malloc(sizeof(BalPacketIeeeOamChannelRxData));
+      memset(oamData, 0, sizeof(BalPacketIeeeOamChannelRxData));
+      bal_packet_ieee_oam_channel_rx_data__init(oamData);
+      balIndCfg->baloamresp->data = oamData;
 
-      balIndCfg.baloamresp->data->pkt.len =  oam_channel->data.pkt.len;
-      balIndCfg.baloamresp->data->pkt.data = (uint8_t *)malloc((balIndCfg.baloamresp->data->pkt.len)*sizeof(uint8_t));
-      memcpy(balIndCfg.baloamresp->data->pkt.data, oam_channel->data.pkt.val,
-             balIndCfg.baloamresp->data->pkt.len);
+      balIndCfg->baloamresp->data->pkt.len =  oam_channel->data.pkt.len;
+      balIndCfg->baloamresp->data->pkt.data = (uint8_t *)malloc((balIndCfg->baloamresp->data->pkt.len)*sizeof(uint8_t));
+      memcpy(balIndCfg->baloamresp->data->pkt.data, oam_channel->data.pkt.val,
+             balIndCfg->baloamresp->data->pkt.len);
 
-      BalErr *output;
-      result = bal_ind__bal_pkt_ieee_oam_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0);
+      list_node *bal_indication_node = malloc(sizeof(list_node));
+      bal_indication_node->bal_indication = balIndCfg;
 
+      pthread_mutex_lock(&bal_ind_queue_lock);
+      add_bal_indication_node(bal_indication_node);
+      pthread_mutex_unlock(&bal_ind_queue_lock);
    }
 
    return result;
diff --git a/src/bal_indications_hdlr.h b/src/bal_indications_hdlr.h
index 8622776..abaa88c 100755
--- a/src/bal_indications_hdlr.h
+++ b/src/bal_indications_hdlr.h
@@ -30,6 +30,7 @@
 #include "bal.grpc-c.h"
 
 #include "asfvolt16_driver.h"
+#include "bal_indications_queue.h"
 
 #define BAL_GRPC_PRES    1 
 
diff --git a/src/bal_indications_queue.c b/src/bal_indications_queue.c
new file mode 100644
index 0000000..ffc9a15
--- /dev/null
+++ b/src/bal_indications_queue.c
@@ -0,0 +1,91 @@
+/*
+** Copyright 2017-present Open Networking Foundation
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include "bal_indications_queue.h"
+
+/*
+ * Implements a circular queue whose size can grow upto MAX_QUEUE_SIZE defined.
+ * Once MAX_QUEUE_SIZE is reached, newest nodes start replacing oldest nodes
+ * in the circular queue.
+ * We define two APIs below, one to get the node from the queue, another to
+ * add node to the queue.
+ */
+
+list_node* get_bal_indication_node(void) {
+   /*'bal_ind_queue_head' should be thread safe there could be simultaneous
+     write from BAL and adapter trying to read from the 'bal_ind_queue_head'.
+     So, protect it under a mutex(bal_ind_queue_lock), before using this MACRO*/
+   list_node *node = NULL;
+   if (num_of_nodes == 1) {
+       node = bal_ind_queue_head;
+       bal_ind_queue_head = NULL;
+       bal_ind_queue_tail = NULL;
+       num_of_nodes = 0;
+   }
+   else if(num_of_nodes > 1) {
+       /*Process if there is at least one node in the queue*/
+       node = bal_ind_queue_head;
+       bal_ind_queue_head = bal_ind_queue_head->next;
+       bal_ind_queue_tail->next = bal_ind_queue_head;
+       --num_of_nodes;
+   }
+
+   return node;
+}
+
+void add_bal_indication_node(list_node *node) {
+   /*'bal_ind_queue_head' should be thread safe there could be simultaneous
+     write from BAL and adapter trying to read from the 'bal_ind_queue_head'.
+     So, protect it under a mutex(bal_ind_queue_lock), before using this MACRO*/
+   if (num_of_nodes == 0 && 
+       bal_ind_queue_head == NULL && 
+       bal_ind_queue_tail == NULL ) {
+      /*Case where the queue is empty*/
+      bal_ind_queue_head = node;
+      bal_ind_queue_tail = node;
+      bal_ind_queue_head->next = node;
+      bal_ind_queue_tail->next = node;
+      ++num_of_nodes;
+   }
+   else if (num_of_nodes == 1 && 
+            bal_ind_queue_head != NULL && 
+            bal_ind_queue_tail != NULL ) {
+      bal_ind_queue_head->next = node;
+      bal_ind_queue_tail = node;
+      bal_ind_queue_tail->next = bal_ind_queue_head;
+      ++num_of_nodes;
+   }
+   else if (num_of_nodes > 1 && 
+            num_of_nodes < MAX_QUEUE_SIZE && 
+            bal_ind_queue_head != NULL && 
+            bal_ind_queue_tail != NULL ) {
+      bal_ind_queue_tail->next = node;
+      bal_ind_queue_tail = node;
+      bal_ind_queue_tail->next = bal_ind_queue_head;
+      ++num_of_nodes;
+   }
+   else if (num_of_nodes == MAX_QUEUE_SIZE && 
+            bal_ind_queue_head != NULL && 
+            bal_ind_queue_tail != NULL  ) {
+      list_node *head_ref = bal_ind_queue_head;
+      bal_ind_queue_tail->next = node;
+      bal_ind_queue_tail = node;
+      bal_ind_queue_head = bal_ind_queue_head->next;
+      bal_ind_queue_tail->next = bal_ind_queue_head;
+      bal_get_ind__free_mem(head_ref->bal_indication);
+      free(head_ref);
+   }
+}
diff --git a/src/bal_indications_queue.h b/src/bal_indications_queue.h
new file mode 100755
index 0000000..075f747
--- /dev/null
+++ b/src/bal_indications_queue.h
@@ -0,0 +1,41 @@
+/*
+** Copyright 2017-present Open Networking Foundation
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifndef __BAL_INDICATIONS_QUEUE_H__
+#define __BAL_INDICATIONS_QUEUE_H__
+
+#include "bal_indications.grpc-c.h"
+
+#define MAX_QUEUE_SIZE 25
+
+typedef struct node {
+    struct node *next;
+    BalIndications *bal_indication;
+}list_node;
+
+
+extern pthread_mutex_t bal_ind_queue_lock;
+extern list_node *bal_ind_queue_head;
+extern list_node *bal_ind_queue_tail;
+extern unsigned int num_of_nodes;
+
+extern void bal_get_ind__free_mem(BalIndications *balIndCfg);
+extern list_node* get_bal_indication_node(void);
+extern void add_bal_indication_node(list_node *node);
+
+
+
+#endif /*__BAL_INDICATIONS_QUEUE_H__*/
\ No newline at end of file
