 //  Utilities
 ///////////////////////////////////////////////////////////////////////////
 
-void handleFade(void) {
+void flashSuccess(bool success) {
+  flashLength = 5000;
+
+  flashBrightness = 255;
+
+  if(success) {
+    flashRed = 0;
+    flashGreen = 255;
+  } else {
+    flashRed = 255;
+    flashGreen = 0;
+  }
+  flashBlue = 0;
+
+  flashRed = map(flashRed, 0, 255, 0, flashBrightness);
+  flashGreen = map(flashGreen, 0, 255, 0, flashBrightness);
+  flashBlue = map(flashBlue, 0, 255, 0, flashBrightness);
+
+  flash = true;
+  startFlash = true;
+}
+
+void handleEffects(void) {
+  if (flash) {
+    if (startFlash) {
+      startFlash = false;
+      flashStartTime = millis();
+      arilux.setWhite(0, 0);
+    }
+    if ((millis() - flashStartTime) <= flashLength) {
+      if ((millis() - flashStartTime) % 1000 <= 500) {
+        arilux.setColor(flashRed, flashGreen, flashBlue);
+      } else {
+        arilux.setColor(0, 0, 0);
+        // If you'd prefer the flashing to happen "on top of"
+        // the current color, uncomment the next line.
+        // arilux.setColor(realRed, realGreen, realBlue);
+      }
+    } else {
+      flash = false;
+      arilux.setColor(realRed, realGreen, realBlue);
+    }
+  }
+
   if (startFade) {
-      // If we don't want to fade, skip it.
-      if (transitionTime == 0) {
-        arilux.setColor(realRed, realGreen, realBlue);
-
-        redVal = realRed;
-        grnVal = realGreen;
-        bluVal = realBlue;
-
-        startFade = false;
+    // If we don't want to fade, skip it.
+    if (transitionTime == 0) {
+      arilux.setColor(realRed, realGreen, realBlue);
+
+      redVal = realRed;
+      grnVal = realGreen;
+      bluVal = realBlue;
+
+      startFade = false;
+      publishColorChange();
+    } else {
+      loopCount = 0;
+      stepR = calculateStep(redVal, realRed);
+      stepG = calculateStep(grnVal, realGreen);
+      stepB = calculateStep(bluVal, realBlue);
+
+      inFade = true;
+    }
+  }
+
+  if (inFade) {
+    startFade = false;
+    unsigned long now = millis();
+    if (now - lastLoop > transitionTime) {
+      if (loopCount <= 1020) {
+        lastLoop = now;
+
+        redVal = calculateVal(stepR, redVal, loopCount);
+        grnVal = calculateVal(stepG, grnVal, loopCount);
+        bluVal = calculateVal(stepB, bluVal, loopCount);
+
+        arilux.setColor(redVal, grnVal, bluVal); // Write current values to LED pins
+
+        DEBUG_PRINT("Fade Loop count: ");
+        DEBUG_PRINTLN(loopCount);
+        loopCount++;
+      } else {
+        inFade = false;
         publishColorChange();
-      } else {
-        loopCount = 0;
-        stepR = calculateStep(redVal, realRed);
-        stepG = calculateStep(grnVal, realGreen);
-        stepB = calculateStep(bluVal, realBlue);
-
-        inFade = true;
       }
     }
-
-    if (inFade) {
-      startFade = false;
-      unsigned long now = millis();
-      if (now - lastLoop > transitionTime) {
-        if (loopCount <= 1020) {
-          lastLoop = now;
-
-          redVal = calculateVal(stepR, redVal, loopCount);
-          grnVal = calculateVal(stepG, grnVal, loopCount);
-          bluVal = calculateVal(stepB, bluVal, loopCount);
-
-          arilux.setColor(redVal, grnVal, bluVal); // Write current values to LED pins
-
-          DEBUG_PRINT("Fade Loop count: ");
-          DEBUG_PRINTLN(loopCount);
-          loopCount++;
-        } else {
-          inFade = false;
-          publishColorChange();
-        }
-      }
-    }
+  }
 }
 
 // From https://www.arduino.cc/en/Tutorial/ColorCrossfader

  // Handle commands
  handleCMD();
  yield();
  handleFade();
  connectMQTT();
  mqttClient.loop();
  yield();

    startFade = true;
    inFade = false; // Kill the current fade

    if (root.containsKey("flash")) {
      flashLength = (int)root["flash"] * 1000;

      if (root.containsKey("brightness")) {
        flashBrightness = root["brightness"];
      } else {
        flashBrightness = arilux.getBrightness();
      }

      if (root.containsKey("color")) {
        flashRed = root["color"]["r"];
        flashGreen = root["color"]["g"];
        flashBlue = root["color"]["b"];
      } else {
        flashRed = arilux.getRedValue();
        flashGreen = arilux.getGreenValue();
        flashBlue = arilux.getBlueValue();
      }

      flashRed = map(flashRed, 0, 255, 0, flashBrightness);
      flashGreen = map(flashGreen, 0, 255, 0, flashBrightness);
      flashBlue = map(flashBlue, 0, 255, 0, flashBrightness);

      flash = true;
      startFlash = true;
    } else { // Not flashing
      flash = false;
      if (arilux.getState() != boolState) {
        arilux.setState(boolState);
        publishStateChange();
      }

      if(boolState) {
        if (arilux.getBrightness() != brightness) {
          arilux.setBrightness(brightness);
          publishBrightnessChange();
        }

        if (arilux.getWhite1Value() != white_value || arilux.getWhite2Value() != white_value) {
          arilux.setWhite(white_value, white_value);
          publishWhiteChange();
        }

        if (arilux.getRedValue() != red_color || arilux.getGreenValue() != green_color || arilux.getBlueValue() != blue_color) {
          arilux.setColor(red_color, green_color, blue_color);
          publishColorChange();
        }
      }
    }
  } else if (String(ARILUX_MQTT_STATE_COMMAND_TOPIC).equals(p_topic)) {
