diff --git a/monitor/argument.cpp b/monitor/argument.cpp
index c756649..90afd10 100644
--- a/monitor/argument.cpp
+++ b/monitor/argument.cpp
@@ -13,10 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "argument.hpp"
+
+#include <algorithm>
 #include <iostream>
 #include <iterator>
-#include <algorithm>
-#include "argument.hpp"
 
 namespace phosphor
 {
@@ -72,12 +73,11 @@
     std::cerr << std::flush;
 }
 
-const option ArgumentParser::options[] =
-{
-    { "init", no_argument, NULL, 'i' },
-    { "monitor", no_argument, NULL, 'm' },
-    { "help", no_argument, NULL, 'h' },
-    { 0, 0, 0, 0 },
+const option ArgumentParser::options[] = {
+    {"init", no_argument, NULL, 'i'},
+    {"monitor", no_argument, NULL, 'm'},
+    {"help", no_argument, NULL, 'h'},
+    {0, 0, 0, 0},
 };
 
 const char* ArgumentParser::optionstr = "imh?";
@@ -85,6 +85,6 @@
 const std::string ArgumentParser::true_string = "true";
 const std::string ArgumentParser::empty_string = "";
 
-}
-}
-}
+} // namespace util
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/conditions.cpp b/monitor/conditions.cpp
index c046f0c..09f5852 100644
--- a/monitor/conditions.cpp
+++ b/monitor/conditions.cpp
@@ -1,7 +1,9 @@
-#include <algorithm>
 #include "conditions.hpp"
+
 #include "sdbusplus.hpp"
 
+#include <algorithm>
+
 namespace phosphor
 {
 namespace fan
@@ -13,19 +15,14 @@
 
 Condition propertiesMatch(std::vector<PropertyState>&& propStates)
 {
-    return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus)
-    {
+    return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus) {
         return std::all_of(
-            pStates.begin(),
-            pStates.end(),
-            [&bus](const auto& p)
-        {
-            return util::SDBusPlus::getPropertyVariant<PropertyValue>(
-                bus,
-                std::get<propObj>(p.first),
-                std::get<propIface>(p.first),
-                std::get<propName>(p.first)) == p.second;
-        });
+            pStates.begin(), pStates.end(), [&bus](const auto& p) {
+                return util::SDBusPlus::getPropertyVariant<PropertyValue>(
+                           bus, std::get<propObj>(p.first),
+                           std::get<propIface>(p.first),
+                           std::get<propName>(p.first)) == p.second;
+            });
     };
 }
 
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index 014080d..bbf8202 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -13,12 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <algorithm>
-#include <phosphor-logging/log.hpp>
 #include "fan.hpp"
+
+#include "sdbusplus.hpp"
 #include "types.hpp"
 #include "utility.hpp"
-#include "sdbusplus.hpp"
+
+#include <phosphor-logging/log.hpp>
+
+#include <algorithm>
 
 namespace phosphor
 {
@@ -29,11 +32,8 @@
 
 using namespace phosphor::logging;
 
-Fan::Fan(Mode mode,
-         sdbusplus::bus::bus& bus,
-         const sdeventplus::Event&  event,
-         std::unique_ptr<trust::Manager>& trust,
-         const FanDefinition& def) :
+Fan::Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+         std::unique_ptr<trust::Manager>& trust, const FanDefinition& def) :
     _bus(bus),
     _name(std::get<fanNameField>(def)),
     _deviation(std::get<fanDeviationField>(def)),
@@ -46,41 +46,30 @@
     {
         try
         {
-            _sensors.emplace_back(
-                    std::make_shared<TachSensor>(
-                            mode,
-                            bus,
-                            *this,
-                            std::get<sensorNameField>(s),
-                            std::get<hasTargetField>(s),
-                            std::get<funcDelay>(def),
-                            std::get<targetInterfaceField>(s),
-                            std::get<factorField>(s),
-                            std::get<offsetField>(s),
-                            std::get<timeoutField>(def),
-                            event));
+            _sensors.emplace_back(std::make_shared<TachSensor>(
+                mode, bus, *this, std::get<sensorNameField>(s),
+                std::get<hasTargetField>(s), std::get<funcDelay>(def),
+                std::get<targetInterfaceField>(s), std::get<factorField>(s),
+                std::get<offsetField>(s), std::get<timeoutField>(def), event));
 
             _trustManager->registerSensor(_sensors.back());
         }
         catch (InvalidSensorError& e)
-        {
-
-        }
+        {}
     }
 
-    //Start from a known state of functional
+    // Start from a known state of functional
     updateInventory(true);
 
     // Check current tach state when entering monitor mode
     if (mode != Mode::init)
     {
-        //The TachSensors will now have already read the input
-        //and target values, so check them.
+        // The TachSensors will now have already read the input
+        // and target values, so check them.
         tachChanged();
     }
 }
 
-
 void Fan::tachChanged()
 {
     for (auto& s : _sensors)
@@ -89,7 +78,6 @@
     }
 }
 
-
 void Fan::tachChanged(TachSensor& sensor)
 {
     if (_trustManager->active())
@@ -100,11 +88,11 @@
         }
     }
 
-    //If this sensor is out of range at this moment, start
-    //its timer, at the end of which the inventory
-    //for the fan may get updated to not functional.
+    // If this sensor is out of range at this moment, start
+    // its timer, at the end of which the inventory
+    // for the fan may get updated to not functional.
 
-    //If this sensor is OK, put everything back into a good state.
+    // If this sensor is OK, put everything back into a good state.
 
     if (outOfRange(sensor))
     {
@@ -128,17 +116,13 @@
     }
 }
 
-
 uint64_t Fan::findTargetSpeed()
 {
     uint64_t target = 0;
-    //The sensor doesn't support a target,
-    //so get it from another sensor.
+    // The sensor doesn't support a target,
+    // so get it from another sensor.
     auto s = std::find_if(_sensors.begin(), _sensors.end(),
-                          [](const auto& s)
-                          {
-                              return s->hasTarget();
-                          });
+                          [](const auto& s) { return s->hasTarget(); });
 
     if (s != _sensors.end())
     {
@@ -148,19 +132,15 @@
     return target;
 }
 
-
 bool Fan::tooManySensorsNonfunctional()
 {
-    size_t numFailed =  std::count_if(_sensors.begin(), _sensors.end(),
-                                      [](const auto& s)
-                                      {
-                                          return !s->functional();
-                                      });
+    size_t numFailed =
+        std::count_if(_sensors.begin(), _sensors.end(),
+                      [](const auto& s) { return !s->functional(); });
 
     return (numFailed >= _numSensorFailsForNonFunc);
 }
 
-
 bool Fan::outOfRange(const TachSensor& sensor)
 {
     auto actual = static_cast<uint64_t>(sensor.getInput());
@@ -184,13 +164,12 @@
     return false;
 }
 
-
 void Fan::timerExpired(TachSensor& sensor)
 {
     sensor.setFunctional(!sensor.functional());
 
-    //If the fan was nonfunctional and enough sensors are now OK,
-    //the fan can go back to functional
+    // If the fan was nonfunctional and enough sensors are now OK,
+    // the fan can go back to functional
     if (!_functional && !tooManySensorsNonfunctional())
     {
         log<level::INFO>("Setting a fan back to functional",
@@ -199,45 +178,38 @@
         updateInventory(true);
     }
 
-    //If the fan is currently functional, but too many
-    //contained sensors are now nonfunctional, update
-    //the whole fan nonfunctional.
+    // If the fan is currently functional, but too many
+    // contained sensors are now nonfunctional, update
+    // the whole fan nonfunctional.
     if (_functional && tooManySensorsNonfunctional())
     {
         log<level::ERR>("Setting a fan to nonfunctional",
-                entry("FAN=%s", _name.c_str()),
-                entry("TACH_SENSOR=%s", sensor.name().c_str()),
-                entry("ACTUAL_SPEED=%lld", sensor.getInput()),
-                entry("TARGET_SPEED=%lld", sensor.getTarget()));
+                        entry("FAN=%s", _name.c_str()),
+                        entry("TACH_SENSOR=%s", sensor.name().c_str()),
+                        entry("ACTUAL_SPEED=%lld", sensor.getInput()),
+                        entry("TARGET_SPEED=%lld", sensor.getTarget()));
 
         updateInventory(false);
     }
 }
 
-
 void Fan::updateInventory(bool functional)
 {
-    auto objectMap = util::getObjMap<bool>(
-            _name,
-            util::OPERATIONAL_STATUS_INTF,
-            util::FUNCTIONAL_PROPERTY,
-            functional);
+    auto objectMap =
+        util::getObjMap<bool>(_name, util::OPERATIONAL_STATUS_INTF,
+                              util::FUNCTIONAL_PROPERTY, functional);
     auto response = util::SDBusPlus::lookupAndCallMethod(
-            _bus,
-            util::INVENTORY_PATH,
-            util::INVENTORY_INTF,
-            "Notify",
-            objectMap);
+        _bus, util::INVENTORY_PATH, util::INVENTORY_INTF, "Notify", objectMap);
     if (response.is_method_error())
     {
         log<level::ERR>("Error in Notify call to update inventory");
         return;
     }
 
-    //This will always track the current state of the inventory.
+    // This will always track the current state of the inventory.
     _functional = functional;
 }
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/fan.hpp b/monitor/fan.hpp
index a581b3b..5136cee 100644
--- a/monitor/fan.hpp
+++ b/monitor/fan.hpp
@@ -1,13 +1,15 @@
 #pragma once
 
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
-#include <tuple>
-#include <vector>
 #include "tach_sensor.hpp"
 #include "trust_manager.hpp"
 #include "types.hpp"
 
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
+#include <tuple>
+#include <vector>
+
 namespace phosphor
 {
 namespace fan
@@ -21,7 +23,8 @@
  * An exception type for sensors that don't exist or
  * are otherwise inaccessible.
  */
-class InvalidSensorError : public std::exception {};
+class InvalidSensorError : public std::exception
+{};
 
 /**
  * @class Fan
@@ -64,140 +67,135 @@
     using Object = sdbusplus::message::object_path;
     using ObjectMap = std::map<Object, InterfaceMap>;
 
-    public:
+  public:
+    Fan() = delete;
+    Fan(const Fan&) = delete;
+    Fan(Fan&&) = default;
+    Fan& operator=(const Fan&) = delete;
+    Fan& operator=(Fan&&) = default;
+    ~Fan() = default;
 
-        Fan() = delete;
-        Fan(const Fan&) = delete;
-        Fan(Fan&&) = default;
-        Fan& operator=(const Fan&) = delete;
-        Fan& operator=(Fan&&) = default;
-        ~Fan() = default;
+    /**
+     * @brief Constructor
+     *
+     * @param mode - mode of fan monitor
+     * @param bus - the dbus object
+     * @param event - event loop reference
+     * @param trust - the tach trust manager
+     * @param def - the fan definition structure
+     */
+    Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+        std::unique_ptr<trust::Manager>& trust, const FanDefinition& def);
 
-        /**
-         * @brief Constructor
-         *
-         * @param mode - mode of fan monitor
-         * @param bus - the dbus object
-         * @param event - event loop reference
-         * @param trust - the tach trust manager
-         * @param def - the fan definition structure
-         */
-        Fan(Mode mode,
-            sdbusplus::bus::bus& bus,
-            const sdeventplus::Event& event,
-            std::unique_ptr<trust::Manager>& trust,
-            const FanDefinition& def);
+    /**
+     * @brief Callback function for when an input sensor changes
+     *
+     * Starts a timer, where if it expires then the sensor
+     * was out of range for too long and can be considered not functional.
+     */
+    void tachChanged(TachSensor& sensor);
 
-        /**
-         * @brief Callback function for when an input sensor changes
-         *
-         * Starts a timer, where if it expires then the sensor
-         * was out of range for too long and can be considered not functional.
-         */
-        void tachChanged(TachSensor& sensor);
+    /**
+     * @brief Calls tachChanged(sensor) on each sensor
+     */
+    void tachChanged();
 
-        /**
-         * @brief Calls tachChanged(sensor) on each sensor
-         */
-        void tachChanged();
+    /**
+     * @brief The callback function for the timer
+     *
+     * Sets the sensor to not functional.
+     * If enough sensors are now not functional,
+     * updates the functional status of the whole
+     * fan in the inventory.
+     *
+     * @param[in] sensor - the sensor whose timer expired
+     */
+    void timerExpired(TachSensor& sensor);
 
-        /**
-         * @brief The callback function for the timer
-         *
-         * Sets the sensor to not functional.
-         * If enough sensors are now not functional,
-         * updates the functional status of the whole
-         * fan in the inventory.
-         *
-         * @param[in] sensor - the sensor whose timer expired
-         */
-        void timerExpired(TachSensor& sensor);
+    /**
+     * @brief Get the name of the fan
+     *
+     * @return - The fan name
+     */
+    inline const std::string& getName() const
+    {
+        return _name;
+    }
 
-        /**
-         * @brief Get the name of the fan
-         *
-         * @return - The fan name
-         */
-        inline const std::string& getName() const
-        {
-            return _name;
-        }
+    /**
+     * @brief Finds the target speed of this fan
+     *
+     * Finds the target speed from the list of sensors that make up this
+     * fan. At least one sensor should contain a target speed value.
+     *
+     * @return - The target speed found from the list of sensors on the fan
+     */
+    uint64_t findTargetSpeed();
 
-        /**
-         * @brief Finds the target speed of this fan
-         *
-         * Finds the target speed from the list of sensors that make up this
-         * fan. At least one sensor should contain a target speed value.
-         *
-         * @return - The target speed found from the list of sensors on the fan
-         */
-        uint64_t findTargetSpeed();
+  private:
+    /**
+     * @brief Returns true if the sensor input is not within
+     * some deviation of the target.
+     *
+     * @param[in] sensor - the sensor to check
+     */
+    bool outOfRange(const TachSensor& sensor);
 
-    private:
+    /**
+     * @brief Returns true if too many sensors are nonfunctional
+     *        as defined by _numSensorFailsForNonFunc
+     */
+    bool tooManySensorsNonfunctional();
 
-        /**
-         * @brief Returns true if the sensor input is not within
-         * some deviation of the target.
-         *
-         * @param[in] sensor - the sensor to check
-         */
-        bool outOfRange(const TachSensor& sensor);
+    /**
+     * @brief Updates the Functional property in the inventory
+     *        for the fan based on the value passed in.
+     *
+     * @param[in] functional - If the Functional property should
+     *                         be set to true or false.
+     */
+    void updateInventory(bool functional);
 
-        /**
-         * @brief Returns true if too many sensors are nonfunctional
-         *        as defined by _numSensorFailsForNonFunc
-         */
-        bool tooManySensorsNonfunctional();
+    /**
+     * @brief the dbus object
+     */
+    sdbusplus::bus::bus& _bus;
 
-        /**
-         * @brief Updates the Functional property in the inventory
-         *        for the fan based on the value passed in.
-         *
-         * @param[in] functional - If the Functional property should
-         *                         be set to true or false.
-         */
-        void updateInventory(bool functional);
+    /**
+     * @brief The inventory name of the fan
+     */
+    const std::string _name;
 
-        /**
-         * @brief the dbus object
-         */
-        sdbusplus::bus::bus& _bus;
+    /**
+     * @brief The percentage that the input speed must be below
+     *        the target speed to be considered an error.
+     *        Between 0 and 100.
+     */
+    const size_t _deviation;
 
-        /**
-         * @brief The inventory name of the fan
-         */
-        const std::string _name;
+    /**
+     * The number of sensors that must be nonfunctional at the
+     * same time in order for the fan to be set to nonfunctional
+     * in the inventory.
+     */
+    const size_t _numSensorFailsForNonFunc;
 
-        /**
-         * @brief The percentage that the input speed must be below
-         *        the target speed to be considered an error.
-         *        Between 0 and 100.
-         */
-        const size_t _deviation;
+    /**
+     * @brief The current functional state of the fan
+     */
+    bool _functional = true;
 
-        /**
-         * The number of sensors that must be nonfunctional at the
-         * same time in order for the fan to be set to nonfunctional
-         * in the inventory.
-         */
-        const size_t _numSensorFailsForNonFunc;
+    /**
+     * The sensor objects for the fan
+     */
+    std::vector<std::shared_ptr<TachSensor>> _sensors;
 
-        /**
-         * @brief The current functional state of the fan
-         */
-        bool _functional = true;
-
-        /**
-         * The sensor objects for the fan
-         */
-        std::vector<std::shared_ptr<TachSensor>> _sensors;
-
-        /**
-         * The tach trust manager object
-         */
-        std::unique_ptr<trust::Manager>& _trustManager;
+    /**
+     * The tach trust manager object
+     */
+    std::unique_ptr<trust::Manager>& _trustManager;
 };
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/fan_defs.hpp b/monitor/fan_defs.hpp
index b766f8e..264e1f6 100644
--- a/monitor/fan_defs.hpp
+++ b/monitor/fan_defs.hpp
@@ -2,8 +2,7 @@
 
 #include "types.hpp"
 
-extern const std::vector<phosphor::fan::monitor::FanDefinition>
-fanDefinitions;
+extern const std::vector<phosphor::fan::monitor::FanDefinition> fanDefinitions;
 
 extern const std::vector<phosphor::fan::monitor::CreateGroupFunction>
-trustGroups;
+    trustGroups;
diff --git a/monitor/main.cpp b/monitor/main.cpp
index cba3832..74cc62d 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -13,14 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
 #include "argument.hpp"
 #include "fan.hpp"
 #include "fan_defs.hpp"
 #include "trust_manager.hpp"
 
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
 using namespace phosphor::fan::monitor;
 using namespace phosphor::logging;
 
@@ -53,10 +54,10 @@
     }
 
     std::unique_ptr<phosphor::fan::trust::Manager> trust =
-            std::make_unique<phosphor::fan::trust::Manager>(trustGroups);
+        std::make_unique<phosphor::fan::trust::Manager>(trustGroups);
 
-    //Attach the event object to the bus object so we can
-    //handle both sd_events (for the timers) and dbus signals.
+    // Attach the event object to the bus object so we can
+    // handle both sd_events (for the timers) and dbus signals.
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
     for (const auto& fanDef : fanDefinitions)
@@ -71,8 +72,8 @@
                 continue;
             }
         }
-        fans.emplace_back(std::make_unique<Fan>(
-                mode, bus, event, trust, fanDef));
+        fans.emplace_back(
+            std::make_unique<Fan>(mode, bus, event, trust, fanDef));
     }
 
     if (mode == Mode::init)
diff --git a/monitor/nonzero_speed_trust.hpp b/monitor/nonzero_speed_trust.hpp
index c5b67fd..9001579 100644
--- a/monitor/nonzero_speed_trust.hpp
+++ b/monitor/nonzero_speed_trust.hpp
@@ -18,48 +18,41 @@
  */
 class NonzeroSpeed : public Group
 {
-    public:
+  public:
+    NonzeroSpeed() = delete;
+    ~NonzeroSpeed() = default;
+    NonzeroSpeed(const NonzeroSpeed&) = delete;
+    NonzeroSpeed& operator=(const NonzeroSpeed&) = delete;
+    NonzeroSpeed(NonzeroSpeed&&) = default;
+    NonzeroSpeed& operator=(NonzeroSpeed&&) = default;
 
-        NonzeroSpeed() = delete;
-        ~NonzeroSpeed() = default;
-        NonzeroSpeed(const NonzeroSpeed&) = delete;
-        NonzeroSpeed& operator=(const NonzeroSpeed&) = delete;
-        NonzeroSpeed(NonzeroSpeed&&) = default;
-        NonzeroSpeed& operator=(NonzeroSpeed&&) = default;
+    /**
+     * Constructor
+     *
+     * @param[in] names - the names of the sensors and its inclusion in
+     * determining trust for the group
+     */
+    explicit NonzeroSpeed(const std::vector<GroupDefinition>& names) :
+        Group(names)
+    {}
 
-        /**
-         * Constructor
-         *
-         * @param[in] names - the names of the sensors and its inclusion in
-         * determining trust for the group
-         */
-        explicit NonzeroSpeed(const std::vector<GroupDefinition>& names) :
-                Group(names)
-        {
-        }
-
-    private:
-
-        /**
-         * Determines if the group is trusted by checking
-         * if any sensor included in the trust determination
-         * has a nonzero speed. If all the speeds of these sensors
-         * are zero, then no sensors in the group are trusted.
-         *
-         * @return bool - if group is trusted or not
-         */
-        bool checkGroupTrust() override
-        {
-            return std::any_of(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        return s.inTrust && s.sensor->getInput() != 0;
-                    });
-        }
+  private:
+    /**
+     * Determines if the group is trusted by checking
+     * if any sensor included in the trust determination
+     * has a nonzero speed. If all the speeds of these sensors
+     * are zero, then no sensors in the group are trusted.
+     *
+     * @return bool - if group is trusted or not
+     */
+    bool checkGroupTrust() override
+    {
+        return std::any_of(_sensors.begin(), _sensors.end(), [](const auto& s) {
+            return s.inTrust && s.sensor->getInput() != 0;
+        });
+    }
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 33904bd..42b826f 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -13,15 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <experimental/filesystem>
-#include <functional>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
+#include "tach_sensor.hpp"
+
 #include "fan.hpp"
 #include "sdbusplus.hpp"
-#include "tach_sensor.hpp"
 #include "utility.hpp"
 
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <experimental/filesystem>
+#include <functional>
+
 namespace phosphor
 {
 namespace fan
@@ -34,8 +37,8 @@
 constexpr auto FAN_VALUE_PROPERTY = "Value";
 
 using namespace std::experimental::filesystem;
-using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
-                            Error::InternalFailure;
+using InternalFailure =
+    sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 
 /**
  * @brief Helper function to read a property
@@ -46,19 +49,15 @@
  * @param[in] bus - the dbus object
  * @param[out] value - filled in with the property value
  */
-template<typename T>
-static void readProperty(const std::string& interface,
-                         const std::string& propertyName,
-                         const std::string& path,
-                         sdbusplus::bus::bus& bus,
-                         T& value)
+template <typename T>
+static void
+    readProperty(const std::string& interface, const std::string& propertyName,
+                 const std::string& path, sdbusplus::bus::bus& bus, T& value)
 {
     try
     {
-        value = util::SDBusPlus::getProperty<T>(bus,
-                                                path,
-                                                interface,
-                                                propertyName);
+        value =
+            util::SDBusPlus::getProperty<T>(bus, path, interface, propertyName);
     }
     catch (std::exception& e)
     {
@@ -66,28 +65,15 @@
     }
 }
 
-
-TachSensor::TachSensor(Mode mode,
-                       sdbusplus::bus::bus& bus,
-                       Fan& fan,
-                       const std::string& id,
-                       bool hasTarget,
-                       size_t funcDelay,
-                       const std::string& interface,
-                       double factor,
-                       int64_t offset,
-                       size_t timeout,
+TachSensor::TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan,
+                       const std::string& id, bool hasTarget, size_t funcDelay,
+                       const std::string& interface, double factor,
+                       int64_t offset, size_t timeout,
                        const sdeventplus::Event& event) :
     _bus(bus),
-    _fan(fan),
-    _name(FAN_SENSOR_PATH + id),
-    _invName(path(fan.getName()) / id),
-    _hasTarget(hasTarget),
-    _funcDelay(funcDelay),
-    _interface(interface),
-    _factor(factor),
-    _offset(offset),
-    _timeout(timeout),
+    _fan(fan), _name(FAN_SENSOR_PATH + id), _invName(path(fan.getName()) / id),
+    _hasTarget(hasTarget), _funcDelay(funcDelay), _interface(interface),
+    _factor(factor), _offset(offset), _timeout(timeout),
     _timerMode(TimerMode::func),
     _timer(event, std::bind(&Fan::timerExpired, &fan, std::ref(*this)))
 {
@@ -102,50 +88,41 @@
             // Use getProperty directly to allow a missing sensor object
             // to abort construction.
             _tachInput = util::SDBusPlus::getProperty<decltype(_tachInput)>(
-                    _bus,
-                    _name,
-                    FAN_SENSOR_VALUE_INTF,
-                    FAN_VALUE_PROPERTY);
+                _bus, _name, FAN_SENSOR_VALUE_INTF, FAN_VALUE_PROPERTY);
         }
         catch (std::exception& e)
         {
             log<level::INFO>("Not monitoring a tach sensor",
-                    entry("SENSOR=%s", _name.c_str()));
+                             entry("SENSOR=%s", _name.c_str()));
             throw InvalidSensorError();
         }
 
         if (_hasTarget)
         {
-            readProperty(_interface,
-                         FAN_TARGET_PROPERTY,
-                         _name,
-                         _bus,
+            readProperty(_interface, FAN_TARGET_PROPERTY, _name, _bus,
                          _tachTarget);
         }
 
         auto match = getMatchString(FAN_SENSOR_VALUE_INTF);
 
         tachSignal = std::make_unique<sdbusplus::server::match::match>(
-                _bus,
-                match.c_str(),
-                [this](auto& msg){ this->handleTachChange(msg); });
+            _bus, match.c_str(),
+            [this](auto& msg) { this->handleTachChange(msg); });
 
         if (_hasTarget)
         {
             match = getMatchString(_interface);
 
             targetSignal = std::make_unique<sdbusplus::server::match::match>(
-                    _bus,
-                    match.c_str(),
-                    [this](auto& msg){ this->handleTargetChange(msg); });
+                _bus, match.c_str(),
+                [this](auto& msg) { this->handleTargetChange(msg); });
         }
     }
 }
 
 std::string TachSensor::getMatchString(const std::string& interface)
 {
-    return sdbusplus::bus::match::rules::propertiesChanged(
-            _name, interface);
+    return sdbusplus::bus::match::rules::propertiesChanged(_name, interface);
 }
 
 uint64_t TachSensor::getTarget() const
@@ -174,11 +151,10 @@
  * @param[in] propertName - the name of the property
  * @param[out] value - the value to store the property value in
  */
-template<typename T>
+template <typename T>
 static void readPropertyFromMessage(sdbusplus::message::message& msg,
                                     const std::string& interface,
-                                    const std::string& propertyName,
-                                    T& value)
+                                    const std::string& propertyName, T& value)
 {
     std::string sensor;
     std::map<std::string, std::variant<T>> data;
@@ -194,28 +170,21 @@
     }
 }
 
-
 void TachSensor::handleTargetChange(sdbusplus::message::message& msg)
 {
-    readPropertyFromMessage(msg,
-                            _interface,
-                            FAN_TARGET_PROPERTY,
-                            _tachTarget);
+    readPropertyFromMessage(msg, _interface, FAN_TARGET_PROPERTY, _tachTarget);
 
-    //Check all tach sensors on the fan against the target
+    // Check all tach sensors on the fan against the target
     _fan.tachChanged();
 }
 
-
 void TachSensor::handleTachChange(sdbusplus::message::message& msg)
 {
-   readPropertyFromMessage(msg,
-                           FAN_SENSOR_VALUE_INTF,
-                           FAN_VALUE_PROPERTY,
-                           _tachInput);
+    readPropertyFromMessage(msg, FAN_SENSOR_VALUE_INTF, FAN_VALUE_PROPERTY,
+                            _tachInput);
 
-   //Check just this sensor against the target
-   _fan.tachChanged(*this);
+    // Check just this sensor against the target
+    _fan.tachChanged(*this);
 }
 
 void TachSensor::startTimer(TimerMode mode)
@@ -231,40 +200,34 @@
 {
     using namespace std::chrono;
 
-    switch(mode)
+    switch (mode)
     {
-        case TimerMode::nonfunc :
-                return duration_cast<microseconds>(seconds(_timeout));
-        case TimerMode::func :
-                return duration_cast<microseconds>(seconds(_funcDelay));
-        default :
-                // Log an internal error for undefined timer mode
-                log<level::ERR>("Undefined timer mode",
-                        entry("TIMER_MODE=%u", mode));
-                elog<InternalFailure>();
-                return duration_cast<microseconds>(seconds(0));
+        case TimerMode::nonfunc:
+            return duration_cast<microseconds>(seconds(_timeout));
+        case TimerMode::func:
+            return duration_cast<microseconds>(seconds(_funcDelay));
+        default:
+            // Log an internal error for undefined timer mode
+            log<level::ERR>("Undefined timer mode",
+                            entry("TIMER_MODE=%u", mode));
+            elog<InternalFailure>();
+            return duration_cast<microseconds>(seconds(0));
     }
 }
 
 void TachSensor::updateInventory(bool functional)
 {
-    auto objectMap = util::getObjMap<bool>(
-            _invName,
-            util::OPERATIONAL_STATUS_INTF,
-            util::FUNCTIONAL_PROPERTY,
-            functional);
+    auto objectMap =
+        util::getObjMap<bool>(_invName, util::OPERATIONAL_STATUS_INTF,
+                              util::FUNCTIONAL_PROPERTY, functional);
     auto response = util::SDBusPlus::lookupAndCallMethod(
-            _bus,
-            util::INVENTORY_PATH,
-            util::INVENTORY_INTF,
-            "Notify",
-            objectMap);
+        _bus, util::INVENTORY_PATH, util::INVENTORY_INTF, "Notify", objectMap);
     if (response.is_method_error())
     {
         log<level::ERR>("Error in notify update of tach sensor inventory");
     }
 }
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index b2b9c50..7ad3c79 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -1,12 +1,13 @@
 #pragma once
 
-#include <chrono>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server.hpp>
 #include <sdeventplus/clock.hpp>
 #include <sdeventplus/event.hpp>
 #include <sdeventplus/utility/timer.hpp>
 
+#include <chrono>
+
 namespace phosphor
 {
 namespace fan
@@ -54,268 +55,259 @@
  */
 class TachSensor
 {
-    public:
+  public:
+    TachSensor() = delete;
+    TachSensor(const TachSensor&) = delete;
+    // TachSensor is not moveable since the this pointer is used as systemd
+    // callback context.
+    TachSensor(TachSensor&&) = delete;
+    TachSensor& operator=(const TachSensor&) = delete;
+    TachSensor& operator=(TachSensor&&) = delete;
+    ~TachSensor() = default;
 
-        TachSensor() = delete;
-        TachSensor(const TachSensor&) = delete;
-        // TachSensor is not moveable since the this pointer is used as systemd
-        // callback context.
-        TachSensor(TachSensor&&) = delete;
-        TachSensor& operator=(const TachSensor&) = delete;
-        TachSensor& operator=(TachSensor&&) = delete;
-        ~TachSensor() = default;
+    /**
+     * @brief Constructor
+     *
+     * @param[in] mode - mode of fan monitor
+     * @param[in] bus - the dbus object
+     * @param[in] fan - the parent fan object
+     * @param[in] id - the id of the sensor
+     * @param[in] hasTarget - if the sensor supports
+     *                        setting the speed
+     * @param[in] funcDelay - Delay to mark functional
+     * @param[in] interface - the interface of the target
+     * @param[in] factor - the factor of the sensor target
+     * @param[in] offset - the offset of the sensor target
+     * @param[in] timeout - Normal timeout value to use
+     * @param[in] event - Event loop reference
+     */
+    TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan,
+               const std::string& id, bool hasTarget, size_t funcDelay,
+               const std::string& interface, double factor, int64_t offset,
+               size_t timeout, const sdeventplus::Event& event);
 
-        /**
-         * @brief Constructor
-         *
-         * @param[in] mode - mode of fan monitor
-         * @param[in] bus - the dbus object
-         * @param[in] fan - the parent fan object
-         * @param[in] id - the id of the sensor
-         * @param[in] hasTarget - if the sensor supports
-         *                        setting the speed
-         * @param[in] funcDelay - Delay to mark functional
-         * @param[in] interface - the interface of the target
-         * @param[in] factor - the factor of the sensor target
-         * @param[in] offset - the offset of the sensor target
-         * @param[in] timeout - Normal timeout value to use
-         * @param[in] event - Event loop reference
-         */
-        TachSensor(Mode mode,
-                   sdbusplus::bus::bus& bus,
-                   Fan& fan,
-                   const std::string& id,
-                   bool hasTarget,
-                   size_t funcDelay,
-                   const std::string& interface,
-                   double factor,
-                   int64_t offset,
-                   size_t timeout,
-                   const sdeventplus::Event& event);
+    /**
+     * @brief Returns the target speed value
+     */
+    uint64_t getTarget() const;
 
-        /**
-         * @brief Returns the target speed value
-         */
-        uint64_t getTarget() const;
+    /**
+     * @brief Returns the input speed value
+     */
+    inline int64_t getInput() const
+    {
+        return _tachInput;
+    }
 
-        /**
-         * @brief Returns the input speed value
-         */
-        inline int64_t getInput() const
-        {
-            return _tachInput;
-        }
+    /**
+     * @brief Returns true if sensor has a target
+     */
+    inline bool hasTarget() const
+    {
+        return _hasTarget;
+    }
 
-        /**
-         * @brief Returns true if sensor has a target
-         */
-        inline bool hasTarget() const
-        {
-            return _hasTarget;
-        }
+    /**
+     * @brief Returns the interface of the sensor target
+     */
+    inline std::string getInterface() const
+    {
+        return _interface;
+    }
 
-        /**
-         * @brief Returns the interface of the sensor target
-         */
-        inline std::string getInterface() const
-        {
-            return _interface;
-        }
+    /**
+     * @brief Returns the factor of the sensor target
+     */
+    inline double getFactor() const
+    {
+        return _factor;
+    }
 
-        /**
-         * @brief Returns the factor of the sensor target
-         */
-        inline double getFactor() const
-        {
-            return _factor;
-        }
+    /**
+     * @brief Returns the offset of the sensor target
+     */
+    inline int64_t getOffset() const
+    {
+        return _offset;
+    }
 
-        /**
-         * @brief Returns the offset of the sensor target
-         */
-        inline int64_t getOffset() const
-        {
-            return _offset;
-        }
+    /**
+     * Returns true if the hardware behind this
+     * sensor is considered working OK/functional.
+     */
+    inline bool functional() const
+    {
+        return _functional;
+    }
 
-        /**
-         * Returns true if the hardware behind this
-         * sensor is considered working OK/functional.
-         */
-        inline bool functional() const
-        {
-            return _functional;
-        }
+    /**
+     * Set the functional status and update inventory to match
+     */
+    void setFunctional(bool functional);
 
-        /**
-         * Set the functional status and update inventory to match
-         */
-        void setFunctional(bool functional);
+    /**
+     * @brief Says if the timer is running or not
+     *
+     * @return bool - if timer is currently running
+     */
+    inline bool timerRunning()
+    {
+        return _timer.isEnabled();
+    }
 
-        /**
-         * @brief Says if the timer is running or not
-         *
-         * @return bool - if timer is currently running
-         */
-        inline bool timerRunning()
-        {
-            return _timer.isEnabled();
-        }
+    /**
+     * @brief Stops the timer when the given mode differs and starts
+     * the associated timer for the mode given if not already running
+     *
+     * @param[in] mode - mode of timer to start
+     */
+    void startTimer(TimerMode mode);
 
-        /**
-         * @brief Stops the timer when the given mode differs and starts
-         * the associated timer for the mode given if not already running
-         *
-         * @param[in] mode - mode of timer to start
-         */
-        void startTimer(TimerMode mode);
+    /**
+     * @brief Stops the timer
+     */
+    inline void stopTimer()
+    {
+        _timer.setEnabled(false);
+    }
 
-        /**
-         * @brief Stops the timer
-         */
-        inline void stopTimer()
-        {
-            _timer.setEnabled(false);
-        }
+    /**
+     * @brief Return the given timer mode's delay time
+     *
+     * @param[in] mode - mode of timer to get delay time for
+     */
+    std::chrono::microseconds getDelay(TimerMode mode);
 
-        /**
-         * @brief Return the given timer mode's delay time
-         *
-         * @param[in] mode - mode of timer to get delay time for
-         */
-        std::chrono::microseconds getDelay(TimerMode mode);
+    /**
+     * Returns the sensor name
+     */
+    inline const std::string& name() const
+    {
+        return _name;
+    };
 
-        /**
-         * Returns the sensor name
-         */
-        inline const std::string& name() const
-        {
-            return _name;
-        };
+  private:
+    /**
+     * @brief Returns the match string to use for matching
+     *        on a properties changed signal.
+     */
+    std::string getMatchString(const std::string& interface);
 
-    private:
+    /**
+     * @brief Reads the Target property and stores in _tachTarget.
+     *        Also calls Fan::tachChanged().
+     *
+     * @param[in] msg - the dbus message
+     */
+    void handleTargetChange(sdbusplus::message::message& msg);
 
-        /**
-         * @brief Returns the match string to use for matching
-         *        on a properties changed signal.
-         */
-        std::string getMatchString(const std::string& interface);
+    /**
+     * @brief Reads the Value property and stores in _tachInput.
+     *        Also calls Fan::tachChanged().
+     *
+     * @param[in] msg - the dbus message
+     */
+    void handleTachChange(sdbusplus::message::message& msg);
 
-        /**
-         * @brief Reads the Target property and stores in _tachTarget.
-         *        Also calls Fan::tachChanged().
-         *
-         * @param[in] msg - the dbus message
-         */
-        void handleTargetChange(sdbusplus::message::message& msg);
+    /**
+     * @brief Updates the Functional property in the inventory
+     *        for this tach sensor based on the value passed in.
+     *
+     * @param[in] functional - If the Functional property should
+     *                         be set to true or false.
+     */
+    void updateInventory(bool functional);
 
-        /**
-         * @brief Reads the Value property and stores in _tachInput.
-         *        Also calls Fan::tachChanged().
-         *
-         * @param[in] msg - the dbus message
-         */
-        void handleTachChange(sdbusplus::message::message& msg);
+    /**
+     * @brief the dbus object
+     */
+    sdbusplus::bus::bus& _bus;
 
-        /**
-         * @brief Updates the Functional property in the inventory
-         *        for this tach sensor based on the value passed in.
-         *
-         * @param[in] functional - If the Functional property should
-         *                         be set to true or false.
-         */
-        void updateInventory(bool functional);
+    /**
+     * @brief Reference to the parent Fan object
+     */
+    Fan& _fan;
 
-        /**
-         * @brief the dbus object
-         */
-        sdbusplus::bus::bus& _bus;
+    /**
+     * @brief The name of the sensor, including the full path
+     *
+     * For example /xyz/openbmc_project/sensors/fan_tach/fan0
+     */
+    const std::string _name;
 
-        /**
-         * @brief Reference to the parent Fan object
-         */
-        Fan& _fan;
+    /**
+     * @brief The inventory name of the sensor, including the full path
+     */
+    const std::string _invName;
 
-        /**
-         * @brief The name of the sensor, including the full path
-         *
-         * For example /xyz/openbmc_project/sensors/fan_tach/fan0
-         */
-        const std::string _name;
+    /**
+     * @brief If functional (not too slow).  The parent
+     *        fan object sets this.
+     */
+    bool _functional;
 
-        /**
-         * @brief The inventory name of the sensor, including the full path
-         */
-        const std::string _invName;
+    /**
+     * @brief If the sensor has a Target property (can set speed)
+     */
+    const bool _hasTarget;
 
-        /**
-         * @brief If functional (not too slow).  The parent
-         *        fan object sets this.
-         */
-        bool _functional;
+    /**
+     * @brief Amount of time to delay updating to functional
+     */
+    const size_t _funcDelay;
 
-        /**
-         * @brief If the sensor has a Target property (can set speed)
-         */
-        const bool _hasTarget;
+    /**
+     * @brief The interface that the target implements
+     */
+    const std::string _interface;
 
-        /**
-         * @brief Amount of time to delay updating to functional
-         */
-        const size_t _funcDelay;
+    /**
+     * @brief The factor of target to get fan rpm
+     */
+    const double _factor;
 
-        /**
-         * @brief The interface that the target implements
-         */
-        const std::string _interface;
+    /**
+     * @brief The offset of target to get fan rpm
+     */
+    const int64_t _offset;
 
-        /**
-         * @brief The factor of target to get fan rpm
-         */
-        const double _factor;
+    /**
+     * @brief The input speed, from the Value dbus property
+     */
+    int64_t _tachInput = 0;
 
-        /**
-         * @brief The offset of target to get fan rpm
-         */
-        const int64_t _offset;
+    /**
+     * @brief The current target speed, from the Target dbus property
+     *        (if applicable)
+     */
+    uint64_t _tachTarget = 0;
 
-        /**
-         * @brief The input speed, from the Value dbus property
-         */
-        int64_t _tachInput = 0;
+    /**
+     * @brief The timeout value to use
+     */
+    const size_t _timeout;
 
-        /**
-         * @brief The current target speed, from the Target dbus property
-         *        (if applicable)
-         */
-        uint64_t _tachTarget = 0;
+    /**
+     * @brief Mode that current timer is in
+     */
+    TimerMode _timerMode;
 
-        /**
-         * @brief The timeout value to use
-         */
-        const size_t _timeout;
+    /**
+     * The timer object
+     */
+    sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer;
 
-        /**
-         * @brief Mode that current timer is in
-         */
-        TimerMode _timerMode;
+    /**
+     * @brief The match object for the Value properties changed signal
+     */
+    std::unique_ptr<sdbusplus::server::match::match> tachSignal;
 
-        /**
-         * The timer object
-         */
-        sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer;
-
-        /**
-         * @brief The match object for the Value properties changed signal
-         */
-        std::unique_ptr<sdbusplus::server::match::match> tachSignal;
-
-        /**
-         * @brief The match object for the Target properties changed signal
-         */
-        std::unique_ptr<sdbusplus::server::match::match> targetSignal;
+    /**
+     * @brief The match object for the Target properties changed signal
+     */
+    std::unique_ptr<sdbusplus::server::match::match> targetSignal;
 };
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/trust_group.hpp b/monitor/trust_group.hpp
index 07d6a0e..e9367e2 100644
--- a/monitor/trust_group.hpp
+++ b/monitor/trust_group.hpp
@@ -1,7 +1,8 @@
 #pragma once
-#include <memory>
 #include "tach_sensor.hpp"
 
+#include <memory>
+
 namespace phosphor
 {
 namespace fan
@@ -11,8 +12,7 @@
 
 constexpr auto sensorName = 0;
 constexpr auto inTrust = 1;
-using GroupDefinition = std::tuple<std::string,
-                                        bool>;
+using GroupDefinition = std::tuple<std::string, bool>;
 
 struct GroupSensor
 {
@@ -42,213 +42,192 @@
  */
 class Group
 {
-    public:
+  public:
+    Group() = delete;
+    virtual ~Group() = default;
+    Group(const Group&) = delete;
+    Group& operator=(const Group&) = delete;
+    Group(Group&&) = default;
+    Group& operator=(Group&&) = default;
 
-        Group() = delete;
-        virtual ~Group() = default;
-        Group(const Group&) = delete;
-        Group& operator=(const Group&) = delete;
-        Group(Group&&) = default;
-        Group& operator=(Group&&) = default;
+    /**
+     * Constructor
+     *
+     * @param[in] names - the names and inclusion of sensors in the group
+     */
+    explicit Group(const std::vector<GroupDefinition>& names) : _names(names)
+    {}
 
-        /**
-         * Constructor
-         *
-         * @param[in] names - the names and inclusion of sensors in the group
-         */
-        explicit Group(const std::vector<GroupDefinition>& names) :
-                _names(names)
+    /**
+     * Used to register a TachSensor object with the group.
+     * It's only added to the group if the sensor's name is
+     * in the group's list of names.
+     *
+     * @param[in] sensor - the TachSensor to register
+     */
+    void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
+    {
+        auto found = std::find_if(
+            _names.begin(), _names.end(), [&sensor](const auto& name) {
+                return monitor::FAN_SENSOR_PATH + std::get<sensorName>(name) ==
+                       sensor->name();
+            });
+
+        if (found != _names.end())
         {
+            _sensors.push_back({sensor, std::get<inTrust>(*found)});
         }
+    }
 
-        /**
-         * Used to register a TachSensor object with the group.
-         * It's only added to the group if the sensor's name is
-         * in the group's list of names.
-         *
-         * @param[in] sensor - the TachSensor to register
-         */
-        void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
-        {
-            auto found = std::find_if(
-                    _names.begin(),
-                    _names.end(),
-                    [&sensor](const auto& name)
-                    {
-                        return monitor::FAN_SENSOR_PATH +
-                                std::get<sensorName>(name) == sensor->name();
-                    });
+    /**
+     * Says if a sensor belongs to the group.
+     *
+     * After all sensors have registered, this can be
+     * used to say if a TachSensor is in the group.
+     *
+     * @param[in] sensor - the TachSensor object
+     */
+    bool inGroup(const monitor::TachSensor& sensor)
+    {
+        return (std::find_if(_sensors.begin(), _sensors.end(),
+                             [&sensor](const auto& s) {
+                                 return sensor.name() == s.sensor->name();
+                             }) != _sensors.end());
+    }
 
-            if (found != _names.end())
+    /**
+     * Stops the timers on all sensors in the group.
+     *
+     * Called when the group just changed to not trusted,
+     * so that its sensors' timers can't fire a callback
+     * that may cause them to be considered faulted.
+     */
+    void stopTimers()
+    {
+        std::for_each(_sensors.begin(), _sensors.end(),
+                      [](const auto& s) { s.sensor->stopTimer(); });
+    }
+
+    /**
+     * Starts the timers on all functional sensors in the group if
+     * their target and input values do not match.
+     *
+     * Called when the group just changed to trusted.
+     */
+    void startTimers()
+    {
+        std::for_each(_sensors.begin(), _sensors.end(), [](const auto& s) {
+            // If a sensor isn't functional, then its timer
+            // already expired so don't bother starting it again
+            if (s.sensor->functional() &&
+                static_cast<uint64_t>(s.sensor->getInput()) !=
+                    s.sensor->getTarget())
             {
-                _sensors.push_back({sensor, std::get<inTrust>(*found)});
+                s.sensor->startTimer(
+                    phosphor::fan::monitor::TimerMode::nonfunc);
             }
-        }
+        });
+    }
 
-        /**
-         * Says if a sensor belongs to the group.
-         *
-         * After all sensors have registered, this can be
-         * used to say if a TachSensor is in the group.
-         *
-         * @param[in] sensor - the TachSensor object
-         */
-         bool inGroup(const monitor::TachSensor& sensor)
-         {
-             return (std::find_if(
-                     _sensors.begin(),
-                     _sensors.end(),
-                     [&sensor](const auto& s)
-                     {
-                         return sensor.name() == s.sensor->name();
-                     }) != _sensors.end());
-         }
-
-        /**
-         * Stops the timers on all sensors in the group.
-         *
-         * Called when the group just changed to not trusted,
-         * so that its sensors' timers can't fire a callback
-         * that may cause them to be considered faulted.
-         */
-        void stopTimers()
+    /**
+     * Determines the trust for this group based on this
+     * sensor's latest status.
+     *
+     * Calls the derived class's checkGroupTrust function
+     * and updates the class with the results.
+     *
+     * If this is called with a sensor not in the group,
+     * it will be considered trusted.
+     *
+     * @param[in] sensor - TachSensor object
+     *
+     * @return tuple<bool, bool> -
+     *   field 0 - the trust value
+     *   field 1 - if that trust value changed since last call
+     *             to checkTrust
+     */
+    auto checkTrust(const monitor::TachSensor& sensor)
+    {
+        if (inGroup(sensor))
         {
-            std::for_each(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        s.sensor->stopTimer();
-                    });
+            auto trust = checkGroupTrust();
+
+            setTrust(trust);
+
+            return std::tuple<bool, bool>(_trusted, _stateChange);
         }
+        return std::tuple<bool, bool>(true, false);
+    }
 
-        /**
-         * Starts the timers on all functional sensors in the group if
-         * their target and input values do not match.
-         *
-         * Called when the group just changed to trusted.
-         */
-        void startTimers()
-        {
-            std::for_each(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        //If a sensor isn't functional, then its timer
-                        //already expired so don't bother starting it again
-                        if (s.sensor->functional() &&
-                            static_cast<uint64_t>(
-                                s.sensor->getInput()) !=
-                                    s.sensor->getTarget())
-                        {
-                            s.sensor->startTimer(
-                                phosphor::fan::monitor::TimerMode::nonfunc);
-                        }
-                    });
-        }
+    /**
+     * Says if all sensors in the group are currently trusted,
+     * as determined by the last call to checkTrust().
+     *
+     * @return bool - if the group's sensors are trusted or not
+     */
+    inline auto getTrust() const
+    {
+        return _trusted;
+    }
 
-        /**
-         * Determines the trust for this group based on this
-         * sensor's latest status.
-         *
-         * Calls the derived class's checkGroupTrust function
-         * and updates the class with the results.
-         *
-         * If this is called with a sensor not in the group,
-         * it will be considered trusted.
-         *
-         * @param[in] sensor - TachSensor object
-         *
-         * @return tuple<bool, bool> -
-         *   field 0 - the trust value
-         *   field 1 - if that trust value changed since last call
-         *             to checkTrust
-         */
-        auto checkTrust(const monitor::TachSensor& sensor)
-        {
-            if (inGroup(sensor))
-            {
-                auto trust = checkGroupTrust();
+    /**
+     * Says if the trust value changed in the last call to
+     * checkTrust()
+     *
+     * @return bool - if the trust changed or not
+     */
+    inline auto trustChanged() const
+    {
+        return _stateChange;
+    }
 
-                setTrust(trust);
+  protected:
+    /**
+     * The sensor objects and their trust inclusion in the group.
+     *
+     * Added by registerSensor().
+     */
+    std::vector<GroupSensor> _sensors;
 
-                return std::tuple<bool, bool>(_trusted, _stateChange);
-            }
-            return std::tuple<bool, bool>(true, false);
-        }
+  private:
+    /**
+     * Checks if the group's sensors are trusted.
+     *
+     * The derived class must override this function
+     * to provide custom functionality.
+     *
+     * @return bool - if group is trusted or not
+     */
+    virtual bool checkGroupTrust() = 0;
 
-        /**
-         * Says if all sensors in the group are currently trusted,
-         * as determined by the last call to checkTrust().
-         *
-         * @return bool - if the group's sensors are trusted or not
-         */
-        inline auto getTrust() const
-        {
-            return _trusted;
-        }
+    /**
+     * Sets the trust value on the object.
+     *
+     * @param[in] trust - the new trust value
+     */
+    inline void setTrust(bool trust)
+    {
+        _stateChange = (trust != _trusted);
+        _trusted = trust;
+    }
 
-        /**
-         * Says if the trust value changed in the last call to
-         * checkTrust()
-         *
-         * @return bool - if the trust changed or not
-         */
-        inline auto trustChanged() const
-        {
-            return _stateChange;
-        }
+    /**
+     * The current trust state of the group
+     */
+    bool _trusted = true;
 
-    protected:
+    /**
+     * If the trust value changed in the last call to checkTrust
+     */
+    bool _stateChange = false;
 
-        /**
-         * The sensor objects and their trust inclusion in the group.
-         *
-         * Added by registerSensor().
-         */
-        std::vector<GroupSensor> _sensors;
-
-    private:
-
-        /**
-         * Checks if the group's sensors are trusted.
-         *
-         * The derived class must override this function
-         * to provide custom functionality.
-         *
-         * @return bool - if group is trusted or not
-         */
-        virtual bool checkGroupTrust() = 0;
-
-        /**
-         * Sets the trust value on the object.
-         *
-         * @param[in] trust - the new trust value
-         */
-        inline void setTrust(bool trust)
-        {
-            _stateChange = (trust != _trusted);
-            _trusted = trust;
-        }
-
-        /**
-         * The current trust state of the group
-         */
-        bool _trusted = true;
-
-        /**
-         * If the trust value changed in the last call to checkTrust
-         */
-        bool _stateChange = false;
-
-        /**
-         * The names of the sensors and whether it is included in
-         * determining trust for this group
-         */
-        const std::vector<GroupDefinition> _names;
+    /**
+     * The names of the sensors and whether it is included in
+     * determining trust for this group
+     */
+    const std::vector<GroupDefinition> _names;
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/trust_manager.hpp b/monitor/trust_manager.hpp
index 031d890..1925003 100644
--- a/monitor/trust_manager.hpp
+++ b/monitor/trust_manager.hpp
@@ -1,11 +1,12 @@
 #pragma once
 
-#include <memory>
-#include <vector>
 #include "tach_sensor.hpp"
 #include "trust_group.hpp"
 #include "types.hpp"
 
+#include <memory>
+#include <vector>
+
 namespace phosphor
 {
 namespace fan
@@ -27,120 +28,112 @@
  */
 class Manager
 {
-    public:
+  public:
+    Manager() = delete;
+    Manager(const Manager&) = delete;
+    Manager& operator=(const Manager&) = delete;
+    Manager(Manager&&) = default;
+    Manager& operator=(Manager&&) = default;
+    ~Manager() = default;
 
-        Manager() = delete;
-        Manager(const Manager&) = delete;
-        Manager& operator=(const Manager&) = delete;
-        Manager(Manager&&) = default;
-        Manager& operator=(Manager&&) = default;
-        ~Manager() = default;
-
-        /**
-         * Constructor
-         *
-         * @param[in] functions - trust group creation function vector
-         */
-        explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+    /**
+     * Constructor
+     *
+     * @param[in] functions - trust group creation function vector
+     */
+    explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+    {
+        for (auto& create : functions)
         {
-            for (auto& create : functions)
-            {
-                groups.emplace_back(create());
-            }
+            groups.emplace_back(create());
         }
+    }
 
-        /**
-         * Says if trust groups have been created and
-         * need to be checked.
-         *
-         * @return bool - If there are any trust groups
-         */
-        inline bool active() const
+    /**
+     * Says if trust groups have been created and
+     * need to be checked.
+     *
+     * @return bool - If there are any trust groups
+     */
+    inline bool active() const
+    {
+        return !groups.empty();
+    }
+
+    /**
+     * Checks if a sensor value can be trusted
+     *
+     * Checks if the sensor is trusted in each group
+     * it belongs to.  Only considered trusted if it is
+     * trusted in all groups it belongs to.
+     *
+     * While checking group trust, the code will also check
+     * if the trust status has just changed.  If the status
+     * just changed to false, it will stop the tach error
+     * timers for that group so these untrusted sensors won't
+     * cause errors.  If changed to true, it will start those timers
+     * back up again.
+     *
+     * Note this means groups should be designed such that
+     * in the same call to this function a sensor shouldn't
+     * make one group change to trusted and another to untrusted.
+     *
+     * @param[in] sensor - the sensor to check
+     *
+     * @return bool - if sensor is trusted in all groups or not
+     */
+    bool checkTrust(const monitor::TachSensor& sensor)
+    {
+        auto trusted = true;
+
+        for (auto& group : groups)
         {
-            return !groups.empty();
-        }
-
-        /**
-         * Checks if a sensor value can be trusted
-         *
-         * Checks if the sensor is trusted in each group
-         * it belongs to.  Only considered trusted if it is
-         * trusted in all groups it belongs to.
-         *
-         * While checking group trust, the code will also check
-         * if the trust status has just changed.  If the status
-         * just changed to false, it will stop the tach error
-         * timers for that group so these untrusted sensors won't
-         * cause errors.  If changed to true, it will start those timers
-         * back up again.
-         *
-         * Note this means groups should be designed such that
-         * in the same call to this function a sensor shouldn't
-         * make one group change to trusted and another to untrusted.
-         *
-         * @param[in] sensor - the sensor to check
-         *
-         * @return bool - if sensor is trusted in all groups or not
-         */
-        bool checkTrust(
-                const monitor::TachSensor& sensor)
-        {
-            auto trusted = true;
-
-            for (auto& group : groups)
+            if (group->inGroup(sensor))
             {
-                if (group->inGroup(sensor))
+                bool trust, changed;
+                std::tie(trust, changed) = group->checkTrust(sensor);
+
+                if (!trust)
                 {
-                    bool trust, changed;
-                    std::tie(trust, changed) = group->checkTrust(sensor);
+                    trusted = false;
 
-                    if (!trust)
+                    if (changed)
                     {
-                        trusted = false;
-
-                        if (changed)
-                        {
-                            group->stopTimers();
-                        }
+                        group->stopTimers();
                     }
-                    else
+                }
+                else
+                {
+                    if (changed)
                     {
-                        if (changed)
-                        {
-                            group->startTimers();
-                        }
+                        group->startTimers();
                     }
                 }
             }
-
-            return trusted;
         }
 
-        /**
-         * Registers a sensor with any trust groups that are interested
-         *
-         * @param[in] sensor - the sensor to register
-         */
-        void registerSensor(
-                std::shared_ptr<monitor::TachSensor>& sensor)
-        {
-            std::for_each(
-                    groups.begin(),
-                    groups.end(),
-                    [&sensor](auto& group)
-                    {
-                        group->registerSensor(sensor);
-                    });
-        }
+        return trusted;
+    }
 
-    private:
+    /**
+     * Registers a sensor with any trust groups that are interested
+     *
+     * @param[in] sensor - the sensor to register
+     */
+    void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
+    {
+        std::for_each(groups.begin(), groups.end(), [&sensor](auto& group) {
+            group->registerSensor(sensor);
+        });
+    }
 
-        /**
-         * The list of sensor trust groups
-         */
-        std::vector<std::unique_ptr<Group>> groups;
+  private:
+    /**
+     * The list of sensor trust groups
+     */
+    std::vector<std::unique_ptr<Group>> groups;
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/types.hpp b/monitor/types.hpp
index 3048961..c827042 100644
--- a/monitor/types.hpp
+++ b/monitor/types.hpp
@@ -1,11 +1,12 @@
 #pragma once
 
+#include "trust_group.hpp"
+
+#include <experimental/optional>
 #include <functional>
 #include <string>
 #include <tuple>
 #include <vector>
-#include <experimental/optional>
-#include "trust_group.hpp"
 
 namespace phosphor
 {
@@ -17,22 +18,16 @@
 constexpr auto propObj = 0;
 constexpr auto propIface = 1;
 constexpr auto propName = 2;
-using PropertyIdentity = std::tuple<std::string,
-                                    std::string,
-                                    std::string>;
+using PropertyIdentity = std::tuple<std::string, std::string, std::string>;
 
-using PropertyValue = std::variant<bool,
-                                   int64_t,
-                                   std::string>;
+using PropertyValue = std::variant<bool, int64_t, std::string>;
 constexpr auto propIdentity = 0;
 constexpr auto propValue = 1;
-using PropertyState = std::pair<PropertyIdentity,
-                                PropertyValue>;
+using PropertyState = std::pair<PropertyIdentity, PropertyValue>;
 
 using Condition = std::function<bool(sdbusplus::bus::bus&)>;
 
-using CreateGroupFunction =
-        std::function<std::unique_ptr<trust::Group>()>;
+using CreateGroupFunction = std::function<std::unique_ptr<trust::Group>()>;
 
 constexpr auto sensorNameField = 0;
 constexpr auto hasTargetField = 1;
@@ -40,11 +35,8 @@
 constexpr auto factorField = 3;
 constexpr auto offsetField = 4;
 
-using SensorDefinition = std::tuple<std::string,
-                                    bool,
-                                    std::string,
-                                    double,
-                                    int64_t>;
+using SensorDefinition =
+    std::tuple<std::string, bool, std::string, double, int64_t>;
 
 constexpr auto fanNameField = 0;
 constexpr auto funcDelay = 1;
@@ -54,14 +46,10 @@
 constexpr auto sensorListField = 5;
 constexpr auto conditionField = 6;
 
-using FanDefinition = std::tuple<std::string,
-                                 size_t,
-                                 size_t,
-                                 size_t,
-                                 size_t,
+using FanDefinition = std::tuple<std::string, size_t, size_t, size_t, size_t,
                                  std::vector<SensorDefinition>,
                                  std::experimental::optional<Condition>>;
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
