diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 655f7f7..0472612 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -835,6 +835,24 @@
     return true;
 }
 
+static bool deviceRequiresPowerOn(const nlohmann::json& entity)
+{
+    auto powerState = entity.find("PowerState");
+    if (powerState != entity.end())
+    {
+        auto ptr = powerState->get_ptr<const std::string*>();
+        if (ptr)
+        {
+            if (*ptr == "On" || *ptr == "BiosPost")
+            {
+                return true;
+            }
+        }
+    }
+
+    return false;
+}
+
 void startRemovedTimer(boost::asio::steady_timer& timer,
                        nlohmann::json& systemConfiguration)
 {
@@ -856,53 +874,41 @@
     }
 
     timer.expires_after(std::chrono::seconds(10));
-    timer.async_wait(
-        [&systemConfiguration](const boost::system::error_code& ec) {
-            if (ec == boost::asio::error::operation_aborted)
-            {
-                // we were cancelled
-                return;
-            }
+    timer.async_wait([&systemConfiguration](
+                         const boost::system::error_code& ec) {
+        if (ec == boost::asio::error::operation_aborted)
+        {
+            // we were cancelled
+            return;
+        }
 
-            bool powerOff = !isPowerOn();
-            for (const auto& item : lastJson.items())
+        bool powerOff = !isPowerOn();
+        for (const auto& item : lastJson.items())
+        {
+            if (systemConfiguration.find(item.key()) ==
+                systemConfiguration.end())
             {
-                if (systemConfiguration.find(item.key()) ==
-                    systemConfiguration.end())
+                bool isDetectedPowerOn = deviceRequiresPowerOn(item.value());
+                if (powerOff && isDetectedPowerOn)
                 {
-                    bool isDetectedPowerOn = false;
-                    auto powerState = item.value().find("PowerState");
-                    if (powerState != item.value().end())
-                    {
-                        auto ptr = powerState->get_ptr<const std::string*>();
-                        if (ptr)
-                        {
-                            if (*ptr == "On" || *ptr == "BiosPost")
-                            {
-                                isDetectedPowerOn = true;
-                            }
-                        }
-                    }
-                    if (powerOff && isDetectedPowerOn)
-                    {
-                        // power not on yet, don't know if it's there or not
-                        continue;
-                    }
-                    if (!powerOff && scannedPowerOff && isDetectedPowerOn)
-                    {
-                        // already logged it when power was off
-                        continue;
-                    }
-
-                    logDeviceRemoved(item.value());
+                    // power not on yet, don't know if it's there or not
+                    continue;
                 }
+                if (!powerOff && scannedPowerOff && isDetectedPowerOn)
+                {
+                    // already logged it when power was off
+                    continue;
+                }
+
+                logDeviceRemoved(item.value());
             }
-            scannedPowerOff = true;
-            if (!powerOff)
-            {
-                scannedPowerOn = true;
-            }
-        });
+        }
+        scannedPowerOff = true;
+        if (!powerOff)
+        {
+            scannedPowerOn = true;
+        }
+    });
 }
 
 // main properties changed entry
@@ -960,20 +966,7 @@
                 bool powerOff = !isPowerOn();
                 for (const auto& item : missingConfigurations->items())
                 {
-                    bool isDetectedPowerOn = false;
-                    auto powerState = item.value().find("PowerState");
-                    if (powerState != item.value().end())
-                    {
-                        auto ptr = powerState->get_ptr<const std::string*>();
-                        if (ptr)
-                        {
-                            if (*ptr == "On" || *ptr == "BiosPost")
-                            {
-                                isDetectedPowerOn = true;
-                            }
-                        }
-                    }
-                    if (powerOff && isDetectedPowerOn)
+                    if (powerOff && deviceRequiresPowerOn(item.value()))
                     {
                         // power not on yet, don't know if it's there or not
                         continue;
