diff --git a/manager.hpp b/manager.hpp
index 9e32216..10af42d 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -2,6 +2,7 @@
 
 #include <map>
 #include <set>
+#include "ledlayout.hpp"
 namespace phosphor
 {
 namespace led
@@ -13,61 +14,62 @@
 class Manager
 {
     public:
-        /** @brief Define possible actions on a given LED.
-         *  For the BLINK operation, follow 50-50 duty cycle
-         */
-        enum Action
-        {
-            Off,
-            On,
-            Blink,
-        };
-
         /** @brief Only need the default Manager */
-        Manager() = default;
+        Manager() = delete;
         ~Manager() = default;
         Manager(const Manager&) = delete;
         Manager& operator=(const Manager&) = delete;
         Manager(Manager&&) = delete;
         Manager& operator=(Manager&&) = delete;
 
-        /** @brief Name of the LED and it's proposed action.
-         *  This structure is supplied as configuration at build time
-         */
-        struct LedAction
-        {
-            std::string name;
-            Action action;
-
-            // Needed for inserting elements into sets
-            bool operator<(const LedAction& right) const
-            {
-                if (name == right.name)
-                {
-                    return action < right.action;
-                }
-                return name < right.name;
-            }
-        };
-
         /** @brief For finding intersection */
-        static bool ledComp(const LedAction& left, const LedAction& right)
+        static bool ledComp(const phosphor::led::Layout::LedAction& left,
+                            const phosphor::led::Layout::LedAction& right)
         {
             return left.name < right.name;
         }
 
-        using group = std::set<LedAction>;
+        using group = std::set<phosphor::led::Layout::LedAction>;
 
         /** @brief static global map constructed at compile time */
-        static const std::map<std::string, group> ledMap;
+        const std::map<std::string, group>& ledMap;
+
+        /** @brief Refer the user supplied LED layout.
+         *
+         *  @param [in] ledLayout - LEDs group layout
+         */
+        explicit Manager(const std::map<std::string, Manager::group>& ledLayout)
+                : ledMap(ledLayout)
+        {
+            // Nothing here
+        }
 
         /** @brief Given a group name, applies the action on the group
          *
-         *  @param[in]  path    -  dbus path of group
-         *  @param[in]  assert  -  Could be true or false
-         *  @return             -  Success or exception thrown
+         *  @param[in]  path          -  dbus path of group
+         *  @param[in]  assert        -  Could be true or false
+         *  @param[in]  ledsAssert    -  LEDs that are to be asserted newly
+         *  @param[in]  ledsDeAssert  -  LEDs that are to be Deasserted
+         *  @param[in]  ledsUpdate    -  LEDs that need a transition between
+         *                               different types of asserted states.
+         *
+         *  @return                   -  Success or exception thrown
          */
-        bool setGroupState(const std::string& path, bool assert);
+        bool setGroupState(const std::string& path, bool assert,
+                           group& ledsAssert, group& ledsDeAssert,
+                           group& ledsUpdate);
+
+        /** @brief Finds the set of LEDs to operate on and executes action
+         *
+         *  @param[in]  ledsAssert    -  LEDs that are to be asserted newly
+         *  @param[in]  ledsDeAssert  -  LEDs that are to be Deasserted
+         *  @param[in]  ledsUpdate    -  LEDs that need a transition between
+         *                               different types of asserted states.
+         *
+         *  @return: None
+         */
+        void driveLEDs(group& ledsAssert, group& ledsDeAssert,
+                       group& ledsUpdate);
 
     private:
         /** @brief Pointers to groups that are in asserted state */
@@ -76,11 +78,6 @@
         /** @brief Contains the LEDs that are in asserted state */
         group currentState;
 
-        /** @brief Finds the set of LEDs to operate on and executes action
-         *
-         *  @return: None
-         */
-        void driveLEDs();
 };
 
 } // namespace led
