diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
index aba2775..99dc302 100644
--- a/src/mdrv2.cpp
+++ b/src/mdrv2.cpp
@@ -35,7 +35,7 @@
 {
     std::vector<uint8_t> responseDir;
 
-    std::ifstream smbiosFile(mdrType2File, std::ios_base::binary);
+    std::ifstream smbiosFile(smbiosFilePath, std::ios_base::binary);
     if (!smbiosFile.good())
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -216,7 +216,7 @@
             "Read data from flash error - Invalid data point");
         return false;
     }
-    std::ifstream smbiosFile(mdrType2File, std::ios_base::binary);
+    std::ifstream smbiosFile(smbiosFilePath, std::ios_base::binary);
     if (!smbiosFile.good())
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -377,7 +377,7 @@
 
 uint8_t MDRV2::directoryEntries(uint8_t value)
 {
-    std::ifstream smbiosFile(mdrType2File, std::ios_base::binary);
+    std::ifstream smbiosFile(smbiosFilePath, std::ios_base::binary);
     if (!smbiosFile.good())
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -394,53 +394,88 @@
 
 void MDRV2::systemInfoUpdate()
 {
+    // By default, look for System interface on any system/board/* object
+    std::string mapperAncestorPath = smbiosInventoryPath;
+    std::string matchParentPath = smbiosInventoryPath + "/board/";
+    bool requireExactMatch = false;
+
+    // If customized, look for System on only that custom object
+    if (smbiosInventoryPath != defaultInventoryPath)
+    {
+        std::filesystem::path path(smbiosInventoryPath);
+
+        // Search under parent to find exact match for self
+        mapperAncestorPath = path.parent_path().string();
+        matchParentPath = mapperAncestorPath;
+        requireExactMatch = true;
+    }
+
     std::string motherboardPath;
-    auto method = bus.new_method_call(mapperBusName, mapperPath,
-                                      mapperInterface, "GetSubTreePaths");
-    method.append(systemInterfacePath);
+    auto method = bus->new_method_call(mapperBusName, mapperPath,
+                                       mapperInterface, "GetSubTreePaths");
+    method.append(mapperAncestorPath);
     method.append(0);
     method.append(std::vector<std::string>({systemInterface}));
 
     try
     {
         std::vector<std::string> paths;
-        sdbusplus::message_t reply = bus.call(method);
+        sdbusplus::message_t reply = bus->call(method);
         reply.read(paths);
-        if (paths.size() < 1)
+
+        size_t pathsCount = paths.size();
+        for (size_t i = 0; i < pathsCount; ++i)
+        {
+            if (requireExactMatch && (paths[i] != smbiosInventoryPath))
+            {
+                continue;
+            }
+
+            motherboardPath = std::move(paths[i]);
+            break;
+        }
+
+        if (motherboardPath.empty())
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
                 "Failed to get system motherboard dbus path. Setting up a "
                 "match rule");
-            // Add match rule if motherboard dbus path is not yet created
-            static std::unique_ptr<sdbusplus::bus::match_t>
+
+            if (!motherboardConfigMatch)
+            {
                 motherboardConfigMatch =
                     std::make_unique<sdbusplus::bus::match_t>(
-                        bus,
+                        *bus,
                         sdbusplus::bus::match::rules::interfacesAdded() +
                             sdbusplus::bus::match::rules::argNpath(
-                                0,
-                                "/xyz/openbmc_project/inventory/system/board/"),
+                                0, matchParentPath),
                         [this](sdbusplus::message_t& msg) {
-                sdbusplus::message::object_path objectName;
-                boost::container::flat_map<
-                    std::string,
+                    sdbusplus::message::object_path objectName;
                     boost::container::flat_map<
-                        std::string, std::variant<std::string, uint64_t>>>
-                    msgData;
-                msg.read(objectName, msgData);
-                if (msgData.contains(systemInterface))
-                {
-                    this->systemInfoUpdate();
-                }
+                        std::string,
+                        boost::container::flat_map<
+                            std::string, std::variant<std::string, uint64_t>>>
+                        msgData;
+                    msg.read(objectName, msgData);
+                    if (msgData.contains(systemInterface))
+                    {
+                        systemInfoUpdate();
+                    }
                         });
+            }
         }
         else
         {
-            motherboardPath = std::move(paths[0]);
+            lg2::info(
+                "Found Inventory anchor object for SMBIOS content {I}: {M}",
+                "I", smbiosInventoryPath, "M", motherboardPath);
         }
     }
     catch (const sdbusplus::exception_t& e)
     {
+        lg2::error(
+            "Exception while trying to find Inventory anchor object for SMBIOS content {I}: {E}",
+            "I", smbiosInventoryPath, "E", e.what());
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "Failed to query system motherboard",
             phosphor::logging::entry("ERROR=%s", e.what()));
@@ -462,11 +497,12 @@
 
     for (unsigned int index = 0; index < *num; index++)
     {
-        std::string path = cpuPath + std::to_string(index);
+        std::string path = smbiosInventoryPath + cpuSuffix +
+                           std::to_string(index);
         if (index + 1 > cpus.size())
         {
             cpus.emplace_back(std::make_unique<phosphor::smbios::Cpu>(
-                bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
+                *bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
                 motherboardPath));
         }
         else
@@ -494,11 +530,12 @@
 
     for (unsigned int index = 0; index < *num; index++)
     {
-        std::string path = dimmPath + std::to_string(index);
+        std::string path = smbiosInventoryPath + dimmSuffix +
+                           std::to_string(index);
         if (index + 1 > dimms.size())
         {
             dimms.emplace_back(std::make_unique<phosphor::smbios::Dimm>(
-                bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
+                *bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
                 motherboardPath));
         }
         else
@@ -526,11 +563,12 @@
 
     for (unsigned int index = 0; index < *num; index++)
     {
-        std::string path = pciePath + std::to_string(index);
+        std::string path = smbiosInventoryPath + pcieSuffix +
+                           std::to_string(index);
         if (index + 1 > pcies.size())
         {
             pcies.emplace_back(std::make_unique<phosphor::smbios::Pcie>(
-                bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
+                *bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage,
                 motherboardPath));
         }
         else
@@ -541,8 +579,9 @@
     }
 
     system.reset();
-    system = std::make_unique<System>(
-        bus, systemPath, smbiosDir.dir[smbiosDirIndex].dataStorage);
+    system = std::make_unique<System>(bus, smbiosInventoryPath + systemSuffix,
+                                      smbiosDir.dir[smbiosDirIndex].dataStorage,
+                                      smbiosFilePath);
 }
 
 std::optional<size_t> MDRV2::getTotalCpuSlot()
@@ -768,7 +807,7 @@
 
     timer.expires_after(usec);
     timer.async_wait([this](boost::system::error_code ec) {
-        if (ec || this == nullptr)
+        if (ec)
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
                 "Timer Error!");
diff --git a/src/mdrv2_main.cpp b/src/mdrv2_main.cpp
index 06a51cb..8dad1d1 100644
--- a/src/mdrv2_main.cpp
+++ b/src/mdrv2_main.cpp
@@ -22,26 +22,24 @@
 #include <sdbusplus/asio/connection.hpp>
 #include <sdbusplus/asio/object_server.hpp>
 
-boost::asio::io_context io;
-auto connection = std::make_shared<sdbusplus::asio::connection>(io);
-auto objServer = sdbusplus::asio::object_server(connection);
-
-sdbusplus::asio::object_server& getObjectServer(void)
+int main()
 {
-    return objServer;
-}
+    auto io = std::make_shared<boost::asio::io_context>();
+    auto connection = std::make_shared<sdbusplus::asio::connection>(*io);
+    auto objServer =
+        std::make_shared<sdbusplus::asio::object_server>(connection);
 
-int main(void)
-{
-    sdbusplus::bus_t& bus = static_cast<sdbusplus::bus_t&>(*connection);
-    sdbusplus::server::manager_t objManager(bus,
+    sdbusplus::server::manager_t objManager(*connection,
                                             "/xyz/openbmc_project/inventory");
 
-    bus.request_name("xyz.openbmc_project.Smbios.MDR_V2");
+    connection->request_name("xyz.openbmc_project.Smbios.MDR_V2");
 
-    phosphor::smbios::MDRV2 mdrV2(bus, phosphor::smbios::mdrV2Path, io);
+    auto mdrV2 = std::make_shared<phosphor::smbios::MDRV2>(
+        io, connection, objServer, mdrDefaultFile,
+        phosphor::smbios::defaultObjectPath,
+        phosphor::smbios::defaultInventoryPath);
 
-    io.run();
+    io->run();
 
     return 0;
 }
diff --git a/src/smbios-ipmi-blobs/handler.cpp b/src/smbios-ipmi-blobs/handler.cpp
index 3763762..fb8111a 100644
--- a/src/smbios-ipmi-blobs/handler.cpp
+++ b/src/smbios-ipmi-blobs/handler.cpp
@@ -15,6 +15,7 @@
 #include <algorithm>
 #include <cstdint>
 #include <ctime>
+#include <filesystem>
 #include <fstream>
 #include <memory>
 #include <string>
@@ -34,7 +35,7 @@
     bool status = false;
     sdbusplus::bus_t bus = sdbusplus::bus_t(ipmid_get_sd_bus_connection());
     sdbusplus::message_t method =
-        bus.new_method_call(mdrV2Service, phosphor::smbios::mdrV2Path,
+        bus.new_method_call(mdrV2Service, phosphor::smbios::defaultObjectPath,
                             mdrV2Interface, "AgentSynchronizeData");
 
     try
@@ -48,7 +49,8 @@
             "Error Sync data with service",
             phosphor::logging::entry("ERROR=%s", e.what()),
             phosphor::logging::entry("SERVICE=%s", mdrV2Service),
-            phosphor::logging::entry("PATH=%s", phosphor::smbios::mdrV2Path));
+            phosphor::logging::entry("PATH=%s",
+                                     phosphor::smbios::defaultObjectPath));
         return false;
     }
 
@@ -191,24 +193,27 @@
     /* Clear the commit_error bit. */
     blobPtr->state &= ~blobs::StateFlags::commit_error;
 
+    std::string defaultDir =
+        std::filesystem::path(mdrDefaultFile).parent_path();
+
     MDRSMBIOSHeader mdrHdr;
     mdrHdr.dirVer = mdrDirVersion;
     mdrHdr.mdrType = mdrTypeII;
     mdrHdr.timestamp = std::time(nullptr);
     mdrHdr.dataSize = blobPtr->buffer.size();
-    if (access(smbiosPath, F_OK) == -1)
+    if (access(defaultDir.c_str(), F_OK) == -1)
     {
-        int flag = mkdir(smbiosPath, S_IRWXU);
+        int flag = mkdir(defaultDir.c_str(), S_IRWXU);
         if (flag != 0)
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
-                "create folder failed for writting smbios file");
+                "create folder failed for writing smbios file");
             blobPtr->state |= blobs::StateFlags::commit_error;
             return false;
         }
     }
 
-    std::ofstream smbiosFile(mdrType2File,
+    std::ofstream smbiosFile(mdrDefaultFile,
                              std::ios_base::binary | std::ios_base::trunc);
     if (!smbiosFile.good())
     {
diff --git a/src/system.cpp b/src/system.cpp
index c0713a6..a838577 100644
--- a/src/system.cpp
+++ b/src/system.cpp
@@ -133,7 +133,7 @@
         if (std::find_if(tempS.begin(), tempS.end(),
                          [](char ch) { return !isprint(ch); }) != tempS.end())
         {
-            std::ofstream smbiosFile(mdrType2File, std::ios_base::trunc);
+            std::ofstream smbiosFile(smbiosFilePath, std::ios_base::trunc);
             if (!smbiosFile.good())
             {
                 phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -149,7 +149,7 @@
         }
         result = tempS;
 
-        setProperty(bus, biosActiveObjPath, biosVersionIntf, biosVersionProp,
+        setProperty(*bus, biosActiveObjPath, biosVersionIntf, biosVersionProp,
                     result);
     }
     lg2::info("VERSION INFO - BIOS - {VER}", "VER", result);
