diff --git a/tools/power-utils/main.cpp b/tools/power-utils/main.cpp
index f240ece..8fae3a1 100644
--- a/tools/power-utils/main.cpp
+++ b/tools/power-utils/main.cpp
@@ -16,6 +16,7 @@
 #include "config.h"
 
 #include "updater.hpp"
+#include "utils.hpp"
 #include "version.hpp"
 
 #include <CLI/CLI.hpp>
@@ -51,7 +52,7 @@
 
     std::string ret;
 
-    bool useJsonFile = version::utils::checkFileExists(PSU_JSON_PATH);
+    bool useJsonFile = utils::checkFileExists(PSU_JSON_PATH);
     auto bus = sdbusplus::bus::new_default();
     if (!psuPath.empty())
     {
diff --git a/tools/power-utils/meson.build b/tools/power-utils/meson.build
index e329393..41149da 100644
--- a/tools/power-utils/meson.build
+++ b/tools/power-utils/meson.build
@@ -2,6 +2,7 @@
     'psutils',
     'version.cpp',
     'updater.cpp',
+    'utils.cpp',
     'main.cpp',
     dependencies: [
         cli11_dep,
diff --git a/tools/power-utils/test/meson.build b/tools/power-utils/test/meson.build
index e48f799..61c5f53 100644
--- a/tools/power-utils/test/meson.build
+++ b/tools/power-utils/test/meson.build
@@ -4,6 +4,7 @@
         'test_version',
         'test_version.cpp',
         '../version.cpp',
+        '../utils.cpp',
         dependencies: [
             gtest,
             nlohmann_json_dep,
@@ -26,7 +27,7 @@
         'test_updater',
         'test_updater.cpp',
         '../updater.cpp',
-        '../version.cpp',
+        '../utils.cpp',
         dependencies: [
             gtest,
             gmock,
diff --git a/tools/power-utils/updater.cpp b/tools/power-utils/updater.cpp
index 951b78c..dab0460 100644
--- a/tools/power-utils/updater.cpp
+++ b/tools/power-utils/updater.cpp
@@ -20,6 +20,7 @@
 #include "pmbus.hpp"
 #include "types.hpp"
 #include "utility.hpp"
+#include "utils.hpp"
 
 #include <sys/stat.h>
 
@@ -76,9 +77,8 @@
         }
         else
         {
-            using namespace version;
             const auto& [i2cbus, i2caddr] =
-                version::utils::getPsuI2c(bus, psuInventoryPath);
+                utils::getPsuI2c(bus, psuInventoryPath);
             const auto DevicePath = "/sys/bus/i2c/devices/";
             std::ostringstream ss;
             ss << std::hex << std::setw(4) << std::setfill('0') << i2caddr;
@@ -253,7 +253,7 @@
 // Wrapper to check existence of PSU JSON file.
 bool usePsuJsonFile()
 {
-    return version::utils::checkFileExists(PSU_JSON_PATH);
+    return utils::checkFileExists(PSU_JSON_PATH);
 }
 } // namespace internal
 
diff --git a/tools/power-utils/updater.hpp b/tools/power-utils/updater.hpp
index 1732f86..251347e 100644
--- a/tools/power-utils/updater.hpp
+++ b/tools/power-utils/updater.hpp
@@ -16,7 +16,6 @@
 #pragma once
 
 #include "i2c_interface.hpp"
-#include "version.hpp"
 
 #include <sdbusplus/bus.hpp>
 
diff --git a/tools/power-utils/utils.cpp b/tools/power-utils/utils.cpp
new file mode 100644
index 0000000..0afc4a8
--- /dev/null
+++ b/tools/power-utils/utils.cpp
@@ -0,0 +1,168 @@
+/**
+ * Copyright © 2024 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "utils.hpp"
+
+#include "utility.hpp"
+
+#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Common/Device/error.hpp>
+
+#include <exception>
+#include <iostream>
+#include <regex>
+#include <stdexcept>
+
+using namespace phosphor::logging;
+using namespace phosphor::power::util;
+using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
+
+namespace utils
+{
+
+constexpr auto IBMCFFPSInterface =
+    "xyz.openbmc_project.Configuration.IBMCFFPSConnector";
+constexpr auto i2cBusProp = "I2CBus";
+constexpr auto i2cAddressProp = "I2CAddress";
+
+PsuI2cInfo getPsuI2c(sdbusplus::bus_t& bus, const std::string& psuInventoryPath)
+{
+    auto depth = 0;
+    auto objects = getSubTree(bus, "/", IBMCFFPSInterface, depth);
+    if (objects.empty())
+    {
+        throw std::runtime_error("Supported Configuration Not Found");
+    }
+
+    std::optional<std::uint64_t> i2cbus;
+    std::optional<std::uint64_t> i2caddr;
+
+    // GET a map of objects back.
+    // Each object will have a path, a service, and an interface.
+    for (const auto& [path, services] : objects)
+    {
+        auto service = services.begin()->first;
+
+        if (path.empty() || service.empty())
+        {
+            continue;
+        }
+
+        // Match the PSU identifier in the path with the passed PSU inventory
+        // path. Compare the last character of both paths to find the PSU bus
+        // and address. example: PSU path:
+        // /xyz/openbmc_project/inventory/system/board/Nisqually_Backplane/Power_Supply_Slot_0
+        // PSU inventory path:
+        // /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
+        if (path.back() == psuInventoryPath.back())
+        {
+            // Retrieve i2cBus and i2cAddress from array of properties.
+            auto properties =
+                getAllProperties(bus, path, IBMCFFPSInterface, service);
+            for (const auto& property : properties)
+            {
+                try
+                {
+                    if (property.first == i2cBusProp)
+                    {
+                        i2cbus = std::get<uint64_t>(properties.at(i2cBusProp));
+                    }
+                    else if (property.first == i2cAddressProp)
+                    {
+                        i2caddr =
+                            std::get<uint64_t>(properties.at(i2cAddressProp));
+                    }
+                }
+                catch (const std::exception& e)
+                {
+                    log<level::WARNING>(
+                        std::format("Error reading property {}: {}",
+                                    property.first, e.what())
+                            .c_str());
+                }
+            }
+
+            if (i2cbus.has_value() && i2caddr.has_value())
+            {
+                break;
+            }
+        }
+    }
+
+    if (!i2cbus.has_value() || !i2caddr.has_value())
+    {
+        throw std::runtime_error("Failed to get I2C bus or address");
+    }
+
+    return std::make_tuple(*i2cbus, *i2caddr);
+}
+
+std::unique_ptr<phosphor::pmbus::PMBusBase>
+    getPmbusIntf(std::uint64_t i2cBus, std::uint64_t i2cAddr)
+{
+    std::stringstream ss;
+    ss << std::hex << std::setw(4) << std::setfill('0') << i2cAddr;
+    return phosphor::pmbus::createPMBus(i2cBus, ss.str());
+}
+
+std::string readVPDValue(phosphor::pmbus::PMBusBase& pmbusIntf,
+                         const std::string& vpdName,
+                         const phosphor::pmbus::Type& type,
+                         const std::size_t& vpdSize)
+{
+    std::string vpdValue;
+    const std::regex illegalVPDRegex =
+        std::regex("[^[:alnum:]]", std::regex::basic);
+
+    try
+    {
+        vpdValue = pmbusIntf.readString(vpdName, type);
+    }
+    catch (const ReadFailure& e)
+    {
+        // Ignore the read failure, let pmbus code indicate failure.
+    }
+
+    if (vpdValue.size() != vpdSize)
+    {
+        log<level::INFO>(
+            std::format(" {} resize needed. size: {}", vpdName, vpdValue.size())
+                .c_str());
+        vpdValue.resize(vpdSize, ' ');
+    }
+
+    // Replace any illegal values with space(s).
+    std::regex_replace(vpdValue.begin(), vpdValue.begin(), vpdValue.end(),
+                       illegalVPDRegex, " ");
+
+    return vpdValue;
+}
+
+bool checkFileExists(const std::string& filePath)
+{
+    try
+    {
+        return std::filesystem::exists(filePath);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>(std::format("Unable to check for existence of {}: {}",
+                                    filePath, e.what())
+                            .c_str());
+    }
+    return false;
+}
+
+} // namespace utils
diff --git a/tools/power-utils/utils.hpp b/tools/power-utils/utils.hpp
new file mode 100644
index 0000000..4c86b54
--- /dev/null
+++ b/tools/power-utils/utils.hpp
@@ -0,0 +1,88 @@
+/**
+ * Copyright © 2024 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "pmbus.hpp"
+
+#include <sdbusplus/bus.hpp>
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <tuple>
+
+/**
+ * @namespace utils
+ *
+ * Contains utility functions used within the psutils tool.
+ */
+namespace utils
+{
+
+// PsuI2cInfo contains the device i2c bus and i2c address
+using PsuI2cInfo = std::tuple<std::uint64_t, std::uint64_t>;
+
+/**
+ * @brief Get i2c bus and address
+ *
+ * @param[in] bus - Systemd bus connection
+ * @param[in] psuInventoryPath - The PSU inventory path.
+ *
+ * @return tuple - i2cBus and i2cAddr.
+ */
+PsuI2cInfo getPsuI2c(sdbusplus::bus_t& bus,
+                     const std::string& psuInventoryPath);
+
+/**
+ * @brief Get PMBus interface pointer
+ *
+ * @param[in] i2cBus - PSU i2c bus
+ * @param[in] i2cAddr - PSU i2c address
+ *
+ * @return Pointer to PSU PMBus interface
+ */
+std::unique_ptr<phosphor::pmbus::PMBusBase>
+    getPmbusIntf(std::uint64_t i2cBus, std::uint64_t i2cAddr);
+
+/**
+ * @brief Reads a VPD value from PMBus, corrects size, and contents.
+ *
+ * If the VPD data read is not the passed in size, resize and fill with
+ * spaces. If the data contains a non-alphanumeric value, replace any of
+ * those values with spaces.
+ *
+ * @param[in] pmbusIntf - PMBus Interface.
+ * @param[in] vpdName - The name of the sysfs "file" to read data from.
+ * @param[in] type - The HWMON file type to read from.
+ * @param[in] vpdSize - The expected size of the data for this VPD/property
+ *
+ * @return A string containing the VPD data read, resized if necessary
+ */
+std::string readVPDValue(phosphor::pmbus::PMBusBase& pmbusIntf,
+                         const std::string& vpdName,
+                         const phosphor::pmbus::Type& type,
+                         const std::size_t& vpdSize);
+
+/**
+ * @brief Check for file existence
+ *
+ * @param[in] filePath - File path
+ *
+ * @return bool
+ */
+bool checkFileExists(const std::string& filePath);
+
+} // namespace utils
diff --git a/tools/power-utils/version.cpp b/tools/power-utils/version.cpp
index fab0705..26507ee 100644
--- a/tools/power-utils/version.cpp
+++ b/tools/power-utils/version.cpp
@@ -19,35 +19,29 @@
 
 #include "pmbus.hpp"
 #include "utility.hpp"
+#include "utils.hpp"
 
+#include <nlohmann/json.hpp>
 #include <phosphor-logging/log.hpp>
-#include <xyz/openbmc_project/Common/Device/error.hpp>
 
 #include <exception>
-#include <iostream>
-#include <regex>
-#include <stdexcept>
 #include <tuple>
 
 using json = nlohmann::json;
 
+using namespace utils;
 using namespace phosphor::logging;
-
 using namespace phosphor::power::util;
-using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
 
 namespace version
 {
-namespace utils
+
+namespace internal
 {
-constexpr auto IBMCFFPSInterface =
-    "xyz.openbmc_project.Configuration.IBMCFFPSConnector";
-constexpr auto i2cBusProp = "I2CBus";
-constexpr auto i2cAddressProp = "I2CAddress";
 
 PsuVersionInfo getVersionInfo(const std::string& psuInventoryPath)
 {
-    auto data = phosphor::power::util::loadJSONFromFile(PSU_JSON_PATH);
+    auto data = loadJSONFromFile(PSU_JSON_PATH);
 
     if (data == nullptr)
     {
@@ -68,7 +62,7 @@
         return {};
     }
 
-    auto type = phosphor::power::util::getPMBusAccessType(data);
+    auto type = getPMBusAccessType(data);
 
     std::string versionStr;
     for (const auto& fru : data["fruConfigs"])
@@ -101,139 +95,12 @@
     return latest;
 }
 
-PsuI2cInfo getPsuI2c(sdbusplus::bus_t& bus, const std::string& psuInventoryPath)
-{
-    auto depth = 0;
-    auto objects = getSubTree(bus, "/", IBMCFFPSInterface, depth);
-    if (objects.empty())
-    {
-        throw std::runtime_error("Supported Configuration Not Found");
-    }
-
-    std::optional<std::uint64_t> i2cbus;
-    std::optional<std::uint64_t> i2caddr;
-
-    // GET a map of objects back.
-    // Each object will have a path, a service, and an interface.
-    for (const auto& [path, services] : objects)
-    {
-        auto service = services.begin()->first;
-
-        if (path.empty() || service.empty())
-        {
-            continue;
-        }
-
-        // Match the PSU identifier in the path with the passed PSU inventory
-        // path. Compare the last character of both paths to find the PSU bus
-        // and address. example: PSU path:
-        // /xyz/openbmc_project/inventory/system/board/Nisqually_Backplane/Power_Supply_Slot_0
-        // PSU inventory path:
-        // /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
-        if (path.back() == psuInventoryPath.back())
-        {
-            // Retrieve i2cBus and i2cAddress from array of properties.
-            auto properties =
-                getAllProperties(bus, path, IBMCFFPSInterface, service);
-            for (const auto& property : properties)
-            {
-                try
-                {
-                    if (property.first == i2cBusProp)
-                    {
-                        i2cbus = std::get<uint64_t>(properties.at(i2cBusProp));
-                    }
-                    else if (property.first == i2cAddressProp)
-                    {
-                        i2caddr =
-                            std::get<uint64_t>(properties.at(i2cAddressProp));
-                    }
-                }
-                catch (const std::exception& e)
-                {
-                    log<level::WARNING>(
-                        std::format("Error reading property {}: {}",
-                                    property.first, e.what())
-                            .c_str());
-                }
-            }
-
-            if (i2cbus.has_value() && i2caddr.has_value())
-            {
-                break;
-            }
-        }
-    }
-
-    if (!i2cbus.has_value() || !i2caddr.has_value())
-    {
-        throw std::runtime_error("Failed to get I2C bus or address");
-    }
-
-    return std::make_tuple(*i2cbus, *i2caddr);
-}
-
-std::unique_ptr<phosphor::pmbus::PMBusBase>
-    getPmbusIntf(std::uint64_t i2cBus, std::uint64_t i2cAddr)
-{
-    std::stringstream ss;
-    ss << std::hex << std::setw(4) << std::setfill('0') << i2cAddr;
-    return phosphor::pmbus::createPMBus(i2cBus, ss.str());
-}
-
-std::string readVPDValue(phosphor::pmbus::PMBusBase& pmbusIntf,
-                         const std::string& vpdName,
-                         const phosphor::pmbus::Type& type,
-                         const std::size_t& vpdSize)
-{
-    std::string vpdValue;
-    const std::regex illegalVPDRegex =
-        std::regex("[^[:alnum:]]", std::regex::basic);
-
-    try
-    {
-        vpdValue = pmbusIntf.readString(vpdName, type);
-    }
-    catch (const ReadFailure& e)
-    {
-        // Ignore the read failure, let pmbus code indicate failure.
-    }
-
-    if (vpdValue.size() != vpdSize)
-    {
-        log<level::INFO>(
-            std::format(" {} resize needed. size: {}", vpdName, vpdValue.size())
-                .c_str());
-        vpdValue.resize(vpdSize, ' ');
-    }
-
-    // Replace any illegal values with space(s).
-    std::regex_replace(vpdValue.begin(), vpdValue.begin(), vpdValue.end(),
-                       illegalVPDRegex, " ");
-
-    return vpdValue;
-}
-
-bool checkFileExists(const std::string& filePath)
-{
-    try
-    {
-        return std::filesystem::exists(filePath);
-    }
-    catch (const std::exception& e)
-    {
-        log<level::ERR>(std::format("Unable to check for existence of {}: {}",
-                                    filePath, e.what())
-                            .c_str());
-    }
-    return false;
-}
-} // namespace utils
+} // namespace internal
 
 std::string getVersion(const std::string& psuInventoryPath)
 {
     const auto& [devicePath, type, versionStr] =
-        utils::getVersionInfo(psuInventoryPath);
+        internal::getVersionInfo(psuInventoryPath);
     if (devicePath.empty() || versionStr.empty())
     {
         return "";
@@ -257,8 +124,8 @@
     std::string version;
     try
     {
-        const auto& [i2cbus, i2caddr] = utils::getPsuI2c(bus, psuInventoryPath);
-        auto pmbus = utils::getPmbusIntf(i2cbus, i2caddr);
+        const auto& [i2cbus, i2caddr] = getPsuI2c(bus, psuInventoryPath);
+        auto pmbus = getPmbusIntf(i2cbus, i2caddr);
         std::string name = "fw_version";
         auto type = phosphor::pmbus::Type::HwmonDeviceDebug;
         version = pmbus->readString(name, type);
@@ -288,6 +155,6 @@
     // means a newer version.
     //
     // So just compare by strings is OK for these cases
-    return utils::getLatestDefault(versions);
+    return internal::getLatestDefault(versions);
 }
 } // namespace version
diff --git a/tools/power-utils/version.hpp b/tools/power-utils/version.hpp
index 534d113..4770a71 100644
--- a/tools/power-utils/version.hpp
+++ b/tools/power-utils/version.hpp
@@ -19,22 +19,18 @@
 
 #include <sdbusplus/bus.hpp>
 
-#include <memory>
 #include <string>
 #include <tuple>
 #include <vector>
 
 namespace version
 {
-namespace utils
+namespace internal
 {
 // PsuInfo contains the device path, pmbus read type, and the version string
 using PsuVersionInfo =
     std::tuple<std::string, phosphor::pmbus::Type, std::string>;
 
-// PsuI2cInfo contains the device i2c bus and i2c address
-using PsuI2cInfo = std::tuple<std::uint64_t, std::uint64_t>;
-
 /**
  * @brief Get PSU version information
  *
@@ -53,57 +49,7 @@
  */
 std::string getLatestDefault(const std::vector<std::string>& versions);
 
-/**
- * @brief Get i2c bus and address
- *
- * @param[in] bus - Systemd bus connection
- * @param[in] psuInventoryPath - The PSU inventory path.
- *
- * @return tuple - i2cBus and i2cAddr.
- */
-PsuI2cInfo getPsuI2c(sdbusplus::bus_t& bus,
-                     const std::string& psuInventoryPath);
-
-/**
- * @brief Get PMBus interface pointer
- *
- * @param[in] i2cBus - PSU i2c bus
- * @param[in] i2cAddr - PSU i2c address
- *
- * @return Pointer to PSU PMBus interface
- */
-std::unique_ptr<phosphor::pmbus::PMBusBase>
-    getPmbusIntf(std::uint64_t i2cBus, std::uint64_t i2cAddr);
-
-/**
- * @brief Reads a VPD value from PMBus, corrects size, and contents.
- *
- * If the VPD data read is not the passed in size, resize and fill with
- * spaces. If the data contains a non-alphanumeric value, replace any of
- * those values with spaces.
- *
- * @param[in] pmbusIntf - PMBus Interface.
- * @param[in] vpdName - The name of the sysfs "file" to read data from.
- * @param[in] type - The HWMON file type to read from.
- * @param[in] vpdSize - The expected size of the data for this VPD/property
- *
- * @return A string containing the VPD data read, resized if necessary
- */
-std::string readVPDValue(phosphor::pmbus::PMBusBase& pmbusIntf,
-                         const std::string& vpdName,
-                         const phosphor::pmbus::Type& type,
-                         const std::size_t& vpdSize);
-
-/**
- * @brief Check for file existence
- *
- * @param[in] filePath - File path
- *
- * @return bool
- */
-bool checkFileExists(const std::string& filePath);
-
-} // namespace utils
+} // namespace internal
 
 /**
  * Get the software version of the PSU using sysfs
