diff --git a/functions.cpp b/functions.cpp
index 24a099e..33b5611 100644
--- a/functions.cpp
+++ b/functions.cpp
@@ -84,26 +84,26 @@
 }
 
 /**
- * @brief Get file extensions for IBMCompatibleSystem
+ * @brief Get file extensions for Compatible
  *
- * IBM host firmware can be deployed as blobs (files) in a filesystem.  Host
+ * IBM host firmware can be deployed as blobs (files) in a filesystem. Host
  * firmware blobs for different values of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem are packaged with
- * different filename extensions.  getExtensionsForIbmCompatibleSystem
- * maintains the mapping from a given value of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem to an array of
- * filename extensions.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible are packaged with
+ * different filename extensions. getExtensionsForIbmCompatibleSystem maintains
+ * the mapping from a given value of
+ * xyz.openbmc_project.Inventory.Decorator.Compatible to an array of filename
+ * extensions.
  *
  * If a mapping is found getExtensionsForIbmCompatibleSystem returns true and
- * the extensions parameter is reset with the map entry.  If no mapping is
- * found getExtensionsForIbmCompatibleSystem returns false and extensions is
+ * the extensions parameter is reset with the map entry. If no mapping is found
+ * getExtensionsForIbmCompatibleSystem returns false and extensions is
  * unmodified.
  *
  * @param[in] extensionMap a map of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem to host firmware blob
- * file extensions.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible to host firmware blob file
+ * extensions.
  * @param[in] ibmCompatibleSystem The names property of an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem
+ * xyz.openbmc_project.Inventory.Decorator.Compatible
  * @param[out] extentions the host firmware blob file extensions
  * @return true if an entry was found, otherwise false
  */
@@ -165,9 +165,9 @@
  * @brief Find host firmware blob files that need well-known names
  *
  * The IBM host firmware runtime looks for data and/or additional code while
- * bootstraping in files with well-known names.  findLinks uses the provided
+ * bootstraping in files with well-known names. findLinks uses the provided
  * extensions argument to find host firmware blob files that require a
- * well-known name.  When a blob is found, issue the provided callback
+ * well-known name. When a blob is found, issue the provided callback
  * (typically a function that will write a symlink).
  *
  * @param[in] hostFirmwareDirectory The directory in which findLinks should
@@ -432,19 +432,18 @@
 
 /**
  * @brief Make callbacks on
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem instances.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible instances.
  *
- * Look for an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem in the provided
- * argument and if found, issue the provided callback.
+ * Look for an instance of xyz.openbmc_project.Inventory.Decorator.Compatible in
+ * the provided argument and if found, issue the provided callback.
  *
  * @param[in] interfacesAndProperties the interfaces in which to look for an
- * instance of xyz.openbmc_project.Configuration.IBMCompatibleSystem
+ * instance of xyz.openbmc_project.Inventory.Decorator.Compatible
  * @param[in] callback the user callback to make if
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem is found in
+ * xyz.openbmc_project.Inventory.Decorator.Compatible is found in
  * interfacesAndProperties
  * @return true if interfacesAndProperties contained an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem, false otherwise
+ * xyz.openbmc_project.Inventory.Decorator.Compatible, false otherwise
  */
 bool maybeCall(const std::map<std::string,
                               std::map<std::string,
@@ -455,20 +454,19 @@
     using namespace std::string_literals;
 
     static const auto interfaceName =
-        "xyz.openbmc_project.Configuration.IBMCompatibleSystem"s;
+        "xyz.openbmc_project.Inventory.Decorator.Compatible"s;
     auto interfaceIterator = interfacesAndProperties.find(interfaceName);
     if (interfaceIterator == interfacesAndProperties.cend())
     {
-        // IBMCompatibleSystem interface not found, so instruct the caller to
-        // keep waiting or try again later.
+        // Compatible interface not found, so instruct the caller to keep
+        // waiting or try again later.
         return false;
     }
     auto propertyIterator = interfaceIterator->second.find("Names"s);
     if (propertyIterator == interfaceIterator->second.cend())
     {
-        // The interface exists but the property doesn't.  This is a bug in the
-        // IBMCompatibleSystem implementation.  The caller should not try
-        // again.
+        // The interface exists but the property doesn't. This is a bug in the
+        // Compatible implementation. The caller should not try again.
         std::cerr << "Names property not implemented on " << interfaceName
                   << "\n";
         return true;
@@ -488,25 +486,23 @@
         }
     }
 
-    // IBMCompatibleSystem found and callback issued.
+    // Compatible found and callback issued.
     return true;
 }
 
 /**
  * @brief Make callbacks on
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem instances.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible instances.
  *
- * Look for an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem in the provided
- * argument and if found, issue the provided callback.
+ * Look for an instance ofxyz.openbmc_project.Inventory.Decorator.Compatible in
+ * the provided argument and if found, issue the provided callback.
  *
  * @param[in] message the DBus message in which to look for an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem
+ * xyz.openbmc_project.Inventory.Decorator.Compatible
  * @param[in] callback the user callback to make if
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem is found in
- * message
+ * xyz.openbmc_project.Inventory.Decorator.Compatible is found in message
  * @return true if message contained an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem, false otherwise
+ * xyz.openbmc_project.Inventory.Decorator.Compatible, false otherwise
  */
 bool maybeCallMessage(sdbusplus::message_t& message,
                       const MaybeCallCallbackType& callback)
@@ -523,17 +519,16 @@
  * @brief Determine system support for host firmware well-known names.
  *
  * Using the provided extensionMap and
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem, determine if
- * well-known names for host firmare blob files are necessary and if so, create
- * them.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible, determine if well-known
+ * names for host firmare blob files are necessary and if so, create them.
  *
  * @param[in] extensionMap a map of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem to host firmware blob
- * file extensions.
- * @param[in] hostFirmwareDirectory The directory in which findLinks should
- * look for host firmware blob files that need well-known names.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible to host firmware blob file
+ * extensions.
+ * @param[in] hostFirmwareDirectory The directory in which findLinks should look
+ * for host firmware blob files that need well-known names.
  * @param[in] ibmCompatibleSystem The names property of an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem
+ * xyz.openbmc_project.Inventory.Decorator.Compatible
  * @param[in] errorCallback A callback made in the event of filesystem errors.
  */
 void maybeMakeLinks(
@@ -554,15 +549,15 @@
  * @brief Determine system support for updating the bios attribute table.
  *
  * Using the provided extensionMap and
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem, determine if the bios
+ * xyz.openbmc_project.Inventory.Decorator.Compatible, determine if the bios
  * attribute table needs to be updated.
  *
  * @param[in] extensionMap a map of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem to host firmware blob
- * file extensions.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible to host firmware blob file
+ * extensions.
  * @param[in] elementsJsonFilePath The file path to the json file
  * @param[in] ibmCompatibleSystem The names property of an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem
+ * xyz.openbmc_project.Inventory.Decorator.Compatible
  */
 void maybeSetBiosAttr(
     const std::map<std::string, std::vector<std::string>>& extensionMap,
@@ -591,27 +586,26 @@
  * added signals from entity manager.
  *
  * Check the current entity manager object tree for a
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem instance (entity
- * manager will be dbus activated if it is not running).  If one is found,
- * determine if symlinks need to be created and create them.  Instruct the
- * program event loop to exit.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible instance (entity manager
+ * will be dbus activated if it is not running). If one is found, determine if
+ * symlinks need to be created and create them. Instruct the program event loop
+ * to exit.
  *
- * If no instance of xyz.openbmc_project.Configuration.IBMCompatibleSystem is
- * found return the callback context to main, where the program will sleep
- * until the callback is invoked one or more times and instructs the program
- * event loop to exit when
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem is added.
+ * If no instance of xyz.openbmc_project.Inventory.Decorator.Compatible is found
+ * return the callback context to main, where the program will sleep until the
+ * callback is invoked one or more times and instructs the program event loop to
+ * exit when xyz.openbmc_project.Inventory.Decorator.Compatible is added.
  *
  * @param[in] bus a DBus client connection
  * @param[in] extensionMap a map of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem to host firmware blob
- * file extensions.
+ * xyz.openbmc_project.Inventory.Decorator.Compatible to host firmware blob file
+ * extensions.
  * @param[in] hostFirmwareDirectory The directory in which processHostFirmware
  * should look for blob files.
  * @param[in] errorCallback A callback made in the event of filesystem errors.
  * @param[in] loop a program event loop
  * @return nullptr if an instance of
- * xyz.openbmc_project.Configuration.IBMCompatibleSystem is found, otherwise a
+ * xyz.openbmc_project.Inventory.Decorator.Compatible is found, otherwise a
  * pointer to an sdbusplus match object.
  */
 std::shared_ptr<void> processHostFirmware(
@@ -631,8 +625,8 @@
     auto pErrorCallback =
         std::make_shared<decltype(errorCallback)>(std::move(errorCallback));
 
-    // register for a callback in case the IBMCompatibleSystem interface has
-    // not yet been published by entity manager.
+    // register for a callback in case the Compatible interface has not yet been
+    // published by entity manager.
     auto interfacesAddedMatch = std::make_shared<sdbusplus::bus::match_t>(
         bus,
         sdbusplus::bus::match::rules::interfacesAdded() +
@@ -648,21 +642,19 @@
                       std::cref(*pErrorCallback));
 
         // if the InterfacesAdded message contains an an instance of
-        // xyz.openbmc_project.Configuration.IBMCompatibleSystem, check to
-        // see if links are necessary on this system and if so, create
-        // them.
+        // xyz.openbmc_project.Inventory.Decorator.Compatible, check to see if
+        // links are necessary on this system and if so, create them.
         if (maybeCallMessage(message, maybeMakeLinksWithArgsBound))
         {
-            // The IBMCompatibleSystem interface was found and the links
-            // were created if applicable.  Instruct the event loop /
-            // subcommand to exit.
+            // The Compatible interface was found and the links were created if
+            // applicable. Instruct the event loop / subcommand to exit.
             loop.exit(0);
         }
     });
 
     // now that we'll get a callback in the event of an InterfacesAdded signal
     // (potentially containing
-    // xyz.openbmc_project.Configuration.IBMCompatibleSystem), activate entity
+    // xyz.openbmc_project.Inventory.Decorator.Compatible), activate entity
     // manager if it isn't running and enumerate its objects
     auto getManagedObjects = bus.new_method_call(
         "xyz.openbmc_project.EntityManager", "/xyz/openbmc_project/inventory",
@@ -695,34 +687,33 @@
     {
         std::tie(std::ignore, interfacesAndProperties) = pair;
         // if interfacesAndProperties contains an an instance of
-        // xyz.openbmc_project.Configuration.IBMCompatibleSystem, check to see
-        // if links are necessary on this system and if so, create them
+        // xyz.openbmc_project.Inventory.Decorator.Compatible, check to see if
+        // links are necessary on this system and if so, create them
         if (maybeCall(interfacesAndProperties, maybeMakeLinksWithArgsBound))
         {
-            // The IBMCompatibleSystem interface is already on the bus and the
-            // links were created if applicable.  Instruct the event loop to
-            // exit.
+            // The Compatible interface is already on the bus and the links were
+            // created if applicable. Instruct the event loop to exit.
             loop.exit(0);
             // The match object isn't needed anymore, so destroy it on return.
             return nullptr;
         }
     }
 
-    // The IBMCompatibleSystem interface has not yet been published.  Move
-    // ownership of the match callback to the caller.
+    // The Compatible interface has not yet been published. Move ownership of
+    // the match callback to the caller.
     return interfacesAddedMatch;
 }
 
 /**
  * @brief Update the Bios Attribute Table
  *
- * If an instance of xyz.openbmc_project.Configuration.IBMCompatibleSystem is
+ * If an instance of xyz.openbmc_project.Inventory.Decorator.Compatible is
  * found, update the Bios Attribute Table with the appropriate host firmware
  * data.
  *
  * @param[in] bus - D-Bus client connection.
- * @param[in] extensionMap - Map of IBMCompatibleSystem names and host firmware
- *                           file extensions.
+ * @param[in] extensionMap - Map of Compatible names and host firmware file
+                             extensions.
  * @param[in] elementsJsonFilePath - The Path to the json file
  * @param[in] loop - Program event loop.
  * @return nullptr
