diff --git a/physical.cpp b/physical.cpp
index 0de2a53..2b404b6 100644
--- a/physical.cpp
+++ b/physical.cpp
@@ -1,5 +1,5 @@
 /**
- * Copyright © 2016 IBM Corporation
+ * Copyright © 2016,2018 IBM Corporation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,86 +26,67 @@
 /** @brief Populates key parameters */
 void Physical::setInitialState()
 {
-    // 1. read /sys/class/leds/name/trigger
-    // 2. If its 'timer', then its blinking.
-    //    2.1: On blink, use delay_on and delay_off into dutyOn
-    // 3. If its 'none', then read brightness. 255 means, its ON, else OFF.
-
     auto trigger = led.getTrigger();
     if (trigger == "timer")
     {
-        // LED is blinking. Get the delay_on and delay_off and compute
-        // DutyCycle. sfsfs values are in strings. Need to convert 'em over to
-        // integer.
+        // LED is blinking. Get the on and off delays and derive percent duty
         auto delayOn = led.getDelayOn();
         auto delayOff = led.getDelayOff();
 
-        // Calculate frequency and then percentage ON
+        // Calculate duty from millisecond delay values and derive percentage on
         periodMs = delayOn + delayOff;
         auto factor = periodMs / 100;
         auto dutyOn = delayOn / factor;
 
-        // Update.
         this->dutyOn(dutyOn);
     }
     else
     {
-        // This is hardcoded for now. This will be changed to this->period()
-        // when configurable periodicity is implemented.
-        // TODO
+        // TODO: Periodicity is hardcoded for now. This will be changed to
+        // this->period() when configurable periodicity is implemented.
         periodMs = 1000;
 
-        // LED is either ON or OFF
+        // Cache current LED state
         auto brightness = led.getBrightness();
         if (brightness == ASSERT)
         {
-            // LED is in Solid ON
-            sdbusplus::xyz::openbmc_project::Led::server ::Physical::state(
+            sdbusplus::xyz::openbmc_project::Led::server::Physical::state(
                 Action::On);
         }
         else
         {
-            // LED is in OFF state
-            sdbusplus::xyz::openbmc_project::Led::server ::Physical::state(
+            sdbusplus::xyz::openbmc_project::Led::server::Physical::state(
                 Action::Off);
         }
     }
     return;
 }
 
-/** @brief Overloaded State Property Setter function */
 auto Physical::state(Action value) -> Action
 {
-    // Obtain current operation
     auto current =
-        sdbusplus::xyz::openbmc_project::Led::server ::Physical::state();
+        sdbusplus::xyz::openbmc_project::Led::server::Physical::state();
 
-    // Update requested operation into base class
     auto requested =
-        sdbusplus::xyz::openbmc_project::Led::server ::Physical::state(value);
+        sdbusplus::xyz::openbmc_project::Led::server::Physical::state(value);
 
-    // Apply the action.
     driveLED(current, requested);
 
     return value;
 }
 
-/** @brief apply action on the LED */
 void Physical::driveLED(Action current, Action request)
 {
     if (current == request)
     {
-        // Best we can do here is ignore.
         return;
     }
 
-    // Transition TO Blinking state
     if (request == Action::Blink)
     {
         return blinkOperation();
     }
 
-    // Transition TO Stable states.
     if (request == Action::On || request == Action::Off)
     {
         return stableStateOperation(request);
@@ -113,35 +94,25 @@
     return;
 }
 
-/** @brief Either TurnON -or- TurnOFF */
 void Physical::stableStateOperation(Action action)
 {
     auto value = (action == Action::On) ? ASSERT : DEASSERT;
 
-    // Write "none" to trigger to clear any previous action
     led.setTrigger("none");
-
-    // And write the current command
     led.setBrightness(value);
     return;
 }
 
-/** @brief BLINK the LED */
 void Physical::blinkOperation()
 {
-    // Get the latest dutyOn that the user requested
     auto dutyOn = this->dutyOn();
 
-    // Write "timer" to "trigger" file
-    led.setTrigger("timer");
-
-    // Write DutyON. Value in percentage 1_millisecond.
-    // so 50% input becomes 500. Driver wants string input
+    // Convert percent duty to milliseconds for sysfs interface
     auto factor = periodMs / 100;
     led.setDelayOn(dutyOn * factor);
-
-    // Write DutyOFF. Value in milli seconds so 50% input becomes 500.
     led.setDelayOff((100 - dutyOn) * factor);
+
+    led.setTrigger("timer");
     return;
 }
 
