diff --git a/mainloop.cpp b/mainloop.cpp
index a59fc1e..e8cf0ee 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -62,6 +62,45 @@
     return std::get<2>(attrs);
 }
 
+auto addValue(const SensorSet::key_type& sensor,
+              const std::string& sysfsRoot, ObjectInfo& info)
+{
+    // Get the initial value for the value interface.
+    auto& bus = *std::get<sdbusplus::bus::bus*>(info);
+    auto& obj = std::get<Object>(info);
+    auto& objPath = std::get<std::string>(info);
+
+    auto sysfsPath = make_sysfs_path(
+                         sysfsRoot,
+                         sensor.first,
+                         sensor.second,
+                         hwmon::entry::input);
+    int val = 0;
+    read_sysfs(sysfsPath, val);
+
+    auto iface = std::make_shared<ValueObject>(bus, objPath.c_str());
+    iface->value(val);
+
+    // *INDENT-OFF*
+    const auto& attrs = std::find_if(
+                            typeAttrMap.begin(),
+                            typeAttrMap.end(),
+                            [&](const auto & e)
+                            {
+                                return sensor.first == getHwmonType(e);
+                            });
+    // *INDENT-ON*
+
+    if (attrs != typeAttrMap.end())
+    {
+        iface->unit(getUnit(*attrs));
+        iface->scale(getScale(*attrs));
+    }
+
+    obj[InterfaceType::VALUE] = iface;
+    return iface;
+}
+
 MainLoop::MainLoop(
     sdbusplus::bus::bus&& bus,
     const std::string& path,
@@ -102,15 +141,6 @@
             continue;
         }
 
-        // Get the initial value for the value interface.
-        auto sysfsPath = make_sysfs_path(
-                             _path,
-                             i.first.first,
-                             i.first.second,
-                             hwmon::entry::input);
-        int val = 0;
-        read_sysfs(sysfsPath, val);
-
         std::string objectPath{_root};
         objectPath.append("/");
         objectPath.append(i.first.first);
@@ -118,25 +148,7 @@
         objectPath.append(label);
 
         ObjectInfo info(&_bus, std::move(objectPath), Object());
-        auto& o = std::get<Object>(info);
-
-        auto iface = std::make_shared<ValueObject>(_bus, objectPath.c_str());
-        iface->value(val);
-
-        const auto& attrs = std::find_if(
-                                typeAttrMap.begin(),
-                                typeAttrMap.end(),
-                                [&](const auto & e)
-        {
-            return i.first.first == getHwmonType(e);
-        });
-        if (attrs != typeAttrMap.end())
-        {
-            iface->unit(getUnit(*attrs));
-            iface->scale(getScale(*attrs));
-        }
-
-        o.emplace(InterfaceType::VALUE, iface);
+        auto valueInterface = addValue(i.first, _path, info);
 
         auto value = std::make_tuple(
                          std::move(i.second),
