diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
index b5789aa..acfafe2 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -381,9 +381,11 @@
 
         tcont = OnuTCont.create(self, tcont=tcontdict)
 
-        self._pon.add_tcont(tcont)
-        new_tconts.append(tcont)
-        self.log.debug('pon-add-tcont', tcont=tcont)
+        success = self._pon.add_tcont(tcont)
+        if success:
+            new_tconts.append(tcont)
+            self.log.debug('pon-add-tcont', tcont=tcont)
+
         return new_tconts
 
     # Called when there is an olt up indication, providing the gem port id chosen by the olt handler
@@ -419,11 +421,11 @@
             gemdict['uni_id'] = uni_id
 
             gem_port = OnuGemPort.create(self, gem_port=gemdict)
-            new_gem_ports.append(gem_port)
 
-            self._pon.add_gem_port(gem_port, True)
-
-            self.log.debug('pon-add-gemport', gem_port=gem_port)
+            success = self._pon.add_gem_port(gem_port, True)
+            if success:
+                new_gem_ports.append(gem_port)
+                self.log.debug('pon-add-gemport', gem_port=gem_port)
 
         return new_gem_ports
 
@@ -527,6 +529,9 @@
                 self.log.info('downloading-tech-profile-configuration', uni_id=uni_id, tp_id=tp_id)
                 self.log.debug("tconts-gems-to-install", tconts=tconts, gem_ports=gem_ports)
 
+                self.log.debug("current-cached-tconts", tconts=list(self.pon_port.tconts.values()))
+                self.log.debug("current-cached-gem-ports", gem_ports=list(self.pon_port.gem_ports.values()))
+
                 self._tp_service_specific_task[uni_id][tp_path] = \
                     BrcmTpSetupTask(self.omci_agent, self, uni_id, tconts, gem_ports, tp_id)
                 self._deferred = \
@@ -661,14 +666,14 @@
             # due to additional tasks on different UNIs. So, it we cannot use the pon_port affter
             # this initializer
             tcont = None
-            self.log.debug("tconts", tconts=list(self.pon_port.tconts.values()))
+            self.log.debug("current-cached-tconts", tconts=list(self.pon_port.tconts.values()))
             for tc in list(self.pon_port.tconts.values()):
                 if tc.alloc_id == alloc_id:
                     tcont = tc
                     self.pon_port.remove_tcont(tc.alloc_id, False)
 
             gem_port = None
-            self.log.debug("gem-ports", gem_ports=list(self.pon_port.gem_ports.values()))
+            self.log.debug("current-cached-gem-ports", gem_ports=list(self.pon_port.gem_ports.values()))
             for gp in list(self.pon_port.gem_ports.values()):
                 if gp.gem_id == gem_port_id:
                     gem_port = gp
@@ -726,7 +731,7 @@
         self._pm_metrics.update(pm_config)
 
     def remove_onu_flows(self, device, flows):
-        self.log.debug('remove_onu_flows', device_id=device.id)
+        self.log.debug('remove-onu-flows')
 
         # no point in removing omci flows if the device isnt reachable
         if device.connect_status != ConnectStatus.REACHABLE or \
@@ -791,13 +796,7 @@
                     self.log.exception('failed-to-remove-flow', e=e)
 
     def add_onu_flows(self, device, flows):
-        self.log.debug('function-entry', flows=flows)
-
-        #
-        # We need to proxy through the OLT to get to the ONU
-        # Configuration from here should be using OMCI
-        #
-        # self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
+        self.log.debug('add-onu-flows')
 
         # no point in pushing omci flows if the device isnt reachable
         if device.connect_status != ConnectStatus.REACHABLE or \
diff --git a/python/adapters/brcm_openomci_onu/pon_port.py b/python/adapters/brcm_openomci_onu/pon_port.py
index f644ec8..634fd7e 100644
--- a/python/adapters/brcm_openomci_onu/pon_port.py
+++ b/python/adapters/brcm_openomci_onu/pon_port.py
@@ -171,32 +171,14 @@
         """
 
         if not self._valid:
-            return  # Deleting
+            return False # Deleting
 
         if not reflow and tcont.alloc_id in self._tconts:
-            return  # already created
+            return False # already created
 
         self.log.info('add-tcont', tcont=tcont.alloc_id, reflow=reflow)
         self._tconts[tcont.alloc_id] = tcont
-
-    def update_tcont_td(self, alloc_id, new_td):
-
-        tcont = self._tconts.get(alloc_id)
-
-        if tcont is None:
-            return  # not-found
-
-        tcont.traffic_descriptor = new_td
-
-        # TODO: Not yet implemented
-        # TODO: How does this affect ONU tcont settings?
-        # try:
-        #    results = yield tcont.add_to_hardware(self._handler.omci)
-        # except Exception as e:
-        #    self.log.exception('tcont', tcont=tcont, e=e)
-        #    # May occur with xPON provisioning, use hw-resync to recover
-        #    results = 'resync needed'
-        # returnValue(results)
+        return True
 
     @inlineCallbacks
     def remove_tcont(self, alloc_id, remove_from_hw=True):
@@ -234,15 +216,16 @@
         """
 
         if not self._valid:
-            return  # Deleting
+            return False # Deleting
 
         if not reflow and (gem_port.gem_id, gem_port.direction) in self._gem_ports:
-            return  # nop
+            return False # nop
 
         # The gem_port entity id is set to be same as gem_id
         gem_port.entity_id = gem_port.gem_id
         self.log.info('add-gem-port', gem_port=gem_port, reflow=reflow)
         self._gem_ports[(gem_port.gem_id, gem_port.direction)] = gem_port
+        return True
 
     @inlineCallbacks
     def remove_gem_id(self, gem_id, direction, remove_from_hw=True):
