diff --git a/util.cpp b/util.cpp
index 411b761..87c4deb 100644
--- a/util.cpp
+++ b/util.cpp
@@ -69,7 +69,12 @@
             std::cout << "\t\t\t{";
             for (const auto& input : pidconf.second.inputs)
             {
-                std::cout << "\n\t\t\t" << input << ",\n";
+                std::cout << "\n\t\t\t" << input.name;
+                if (input.convertTempToMargin)
+                {
+                    std::cout << "[" << input.convertMarginZero << "]";
+                }
+                std::cout << ",\n";
             }
             std::cout << "\t\t\t}\n";
             std::cout << "\t\t\t" << pidconf.second.setpoint << ",\n";
@@ -96,4 +101,51 @@
     std::cout << "}\n\n";
 }
 
+std::vector<conf::SensorInput>
+    spliceInputs(const std::vector<std::string>& inputNames,
+                 const std::vector<double>& inputTempToMargin)
+{
+    std::vector<conf::SensorInput> results;
+
+    // Default to the TempToMargin feature disabled
+    for (const auto& inputName : inputNames)
+    {
+        conf::SensorInput newInput{
+            inputName, std::numeric_limits<double>::quiet_NaN(), false};
+
+        results.emplace_back(newInput);
+    }
+
+    size_t resultSize = results.size();
+    size_t marginSize = inputTempToMargin.size();
+
+    for (size_t index = 0; index < resultSize; ++index)
+    {
+        // If fewer doubles than strings, and vice versa, ignore remainder
+        if (index >= marginSize)
+        {
+            break;
+        }
+
+        // Both vectors have this index, combine both into SensorInput
+        results[index].convertMarginZero = inputTempToMargin[index];
+        results[index].convertTempToMargin = true;
+    }
+
+    return results;
+}
+
+std::vector<std::string>
+    splitNames(const std::vector<conf::SensorInput>& sensorInputs)
+{
+    std::vector<std::string> results;
+
+    for (const auto& sensorInput : sensorInputs)
+    {
+        results.emplace_back(sensorInput.name);
+    }
+
+    return results;
+}
+
 } // namespace pid_control
