diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index d7051cf..63512a3 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -87,6 +87,15 @@
                 auto propVal = std::get<std::string>(value);
                 if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
                 {
+                    // Delete all the remote terminus information
+                    for (const auto& terminusInfo : this->tlPDRInfo)
+                    {
+                        if (terminusInfo.first != TERMINUS_HANDLE)
+                        {
+                            this->tlPDRInfo.erase(terminusInfo.first);
+                        }
+                    }
+
                     pldm_pdr_remove_remote_pdrs(repo);
                     pldm_entity_association_tree_destroy_root(entityTree);
                     pldm_entity_association_tree_copy_root(bmcEntityTree,
@@ -332,8 +341,7 @@
     }
 }
 
-void HostPDRHandler::parseStateSensorPDRs(const PDRList& stateSensorPDRs,
-                                          const TLPDRMap& tlpdrInfo)
+void HostPDRHandler::parseStateSensorPDRs(const PDRList& stateSensorPDRs)
 {
     for (const auto& pdr : stateSensorPDRs)
     {
@@ -343,7 +351,7 @@
         sensorEntry.sensorID = sensorID;
         try
         {
-            sensorEntry.terminusID = tlpdrInfo.at(terminusHandle);
+            sensorEntry.terminusID = std::get<0>(tlPDRInfo.at(terminusHandle));
         }
         // If there is no mapping for terminusHandle assign the reserved TID
         // value of 0xFF to indicate that.
@@ -361,9 +369,7 @@
 {
     static bool merged = false;
     static PDRList stateSensorPDRs{};
-    static TLPDRMap tlpdrInfo{};
     uint32_t nextRecordHandle{};
-    std::vector<TlInfo> tlInfo;
     uint8_t tlEid = 0;
     bool tlValid = true;
     uint32_t rh = 0;
@@ -440,10 +446,6 @@
                     auto tlpdr =
                         reinterpret_cast<const pldm_terminus_locator_pdr*>(
                             pdr.data());
-                    tlpdrInfo.emplace(
-                        static_cast<pldm::pdr::TerminusHandle>(
-                            tlpdr->terminus_handle),
-                        static_cast<pldm::pdr::TerminusID>(tlpdr->tid));
 
                     terminusHandle = tlpdr->terminus_handle;
                     tid = tlpdr->tid;
@@ -460,9 +462,9 @@
                     {
                         tlValid = false;
                     }
-                    tlInfo.emplace_back(
-                        TlInfo{tlpdr->validity, static_cast<uint8_t>(tlEid),
-                               tlpdr->tid, tlpdr->terminus_handle});
+                    tlPDRInfo.insert_or_assign(
+                        tlpdr->terminus_handle,
+                        std::make_tuple(tlpdr->tid, tlEid, tlpdr->validity));
                 }
                 else if (pdrHdr->type == PLDM_STATE_SENSOR_PDR)
                 {
@@ -485,13 +487,12 @@
     if (!nextRecordHandle)
     {
         /*received last record*/
-        this->parseStateSensorPDRs(stateSensorPDRs, tlpdrInfo);
+        this->parseStateSensorPDRs(stateSensorPDRs);
         if (isHostUp())
         {
-            this->setHostSensorState(stateSensorPDRs, tlInfo);
+            this->setHostSensorState(stateSensorPDRs);
         }
         stateSensorPDRs.clear();
-        tlpdrInfo.clear();
         if (merged)
         {
             merged = false;
@@ -579,8 +580,7 @@
     return responseReceived;
 }
 
-void HostPDRHandler::setHostSensorState(const PDRList& stateSensorPDRs,
-                                        const std::vector<TlInfo>& tlinfo)
+void HostPDRHandler::setHostSensorState(const PDRList& stateSensorPDRs)
 {
     for (const auto& stateSensorPDR : stateSensorPDRs)
     {
@@ -597,18 +597,18 @@
 
         uint16_t sensorId = pdr->sensor_id;
 
-        for (auto info : tlinfo)
+        for (const auto& [terminusHandle, terminusInfo] : tlPDRInfo)
         {
-            if (info.terminusHandle == pdr->terminus_handle)
+            if (terminusHandle == pdr->terminus_handle)
             {
-                if (info.valid == PLDM_TL_PDR_VALID)
+                if (std::get<2>(terminusInfo) == PLDM_TL_PDR_VALID)
                 {
-                    mctp_eid = info.eid;
+                    mctp_eid = std::get<1>(terminusInfo);
                 }
 
                 bitfield8_t sensorRearm;
                 sensorRearm.byte = 0;
-                uint8_t tid = info.tid;
+                uint8_t tid = std::get<0>(terminusInfo);
 
                 auto instanceId = requester.getInstanceId(mctp_eid);
                 std::vector<uint8_t> requestMsg(
