   pinMode(FAN, OUTPUT);
   pinMode(BOARDLED, OUTPUT);
   digitalWrite(BOARDLED, LOW);
-  
+
   // Read info from eeprom, contains calibration values from before. If this is the first run time, use default probe settings.
   eeprom_read_block(&params, (void *)0, sizeof(params));
-  if (params.WriteCheck != Write_Check){
+  if (params.WriteCheck != Write_Check) {
     reset_Params();
   }
 }
 
-void loop()
-{
+void loop() {
   t = now();
-  
-  while (Serial.available() > 0){ //Keep working as long as data is in the buffer
+
+  // Keep working as long as data is in the buffer
+  while (Serial.available() > 0) {
     serialControl();
   }
-  
-  if(t >= tDelay)
-  {
-    if(runProgram == 1)
-    {
-      scheduleFromUser();
-      setLight();
-      if(minute(t) == 0){ //Only run the pump for 1 min when scheduled for an hour
-        setPump();
-      }
-      if(minute(t) > 0 && pumpOn == 1){
-        pumpOn = 0;
-        setPump();
-      }
-      setFan(fanStatus);
+
+  if (t < tDelay) {
+    return;
+  }
+
+  if (runProgram == 1) {
+    scheduleFromUser();
+    setLight();
+    setFan(fanStatus);
+
+    /**
+     * The scheduling is per hour, but running the pump for that long is
+     * unnessesary since it only takes about 30s to fill the pressure
+     * accumulator.
+     * Only run the pump during the first minute of the scheduled hour.
+     */
+    if (pumpOn == 1 && minute(t) > 0) {
+      pumpOn = 0;
     }
-    if(nozzleInterval-1 == minute(t) % nozzleInterval)
-    {
-      if(nozzleDuration > second(t))
-      {
-        digitalWrite(NOZZLE, HIGH);
-        oneReport = 1;
-      }
-      if(nozzleDuration <= second(t))
-      {
-        digitalWrite(NOZZLE, LOW);
-        if(oneReport == 1){
-          oneReport = 0;
-          serialReport();
-        }
-      }
+    setPump();
+  }
+  if (nozzleInterval-1 == minute(t) % nozzleInterval) {
+    if (nozzleDuration > second(t)) {
+      digitalWrite(NOZZLE, HIGH);
+      oneReport = 1;
     }
-    if(t >= tDelayMin)
-    {
-      readSensors();
-      if(sensorTempData[0] >= 30 || sensorTempData[1] >= 50)
-      {
-        setFan(1);
-      }
-      if(sensorTempData[0] < 30 && sensorTempData[1] < 50)
-      {
-        setFan(0);
-      }
-      tDelayMin = t + measureInterval;
+    if (nozzleDuration <= second(t)) {
+      digitalWrite(NOZZLE, LOW);
+      if (oneReport == 1) {
+        oneReport = 0;
+        serialReport();
+      }
     }
-    tDelay = t + runInterval;
-  }
+  }
+  if (t >= tDelayMin) {
+    readSensors();
+
+    if (sensorTempData[0] >= 30 || sensorTempData[1] >= 50) {
+      setFan(1);
+    }
+    if(sensorTempData[0] < 30 && sensorTempData[1] < 50) {
+      setFan(0);
+    }
+
+    tDelayMin = t + measureInterval;
+  }
+
+  tDelay = t + runInterval;
 }
 
 /*
- * Messages consist of the letter S followed by 
+ * Messages consist of the letter S followed by
  * int(0-255),int(0-255),int(0-255),int(0-1),int(0-30),int(0-10),int(0-1)
  * S,255,255,255,0,20,5,0 (R,G,B,pump,nozzlieInterval,nozzleDuration,fan)
  */
 void serialControl()
 {
-    char c = Serial.read(); 
+    char c = Serial.read();
     switch(c){
-      case 'S': 
+      case 'S':
       {
         rval   = Serial.parseInt(); //First valid integer
         gval   = Serial.parseInt(); //Second valid integer

        nozzleInterval = Serial.parseInt(); //Fifth valid integer
        nozzleDuration = Serial.parseInt(); //sixth valid integer
        fanStatus = Serial.parseInt(); //seventh valid integer
        
        setLight();
        setPump();
        setNozzle();

/*
 * Work in progress
 */
#include <DHT.h>        // For the DHT11 temperature and humidity sensor
#include <Time.h>       // For timekeeping
#include <Wire.h>       // For I2C
#include <avr/eeprom.h> // For storing calibration and configration in EEPROM


//Define LED pins (PWM pins: 3,5,6,9,10,11 on arduino UNO)
const int RED   = 11;
const int GREEN = 10;
const int BLUE  = 9;
const int PUMP  = 2;
const int NOZZLE = 12;
const int FAN = 7;
const int BOARDLED = 13; //Pin 13 and Arduino UNO board LED
const int LIGHT = A0;           // Light sensor, Analog pin 0
const int runInterval = 1;      // Define delay between the run and measure interval in seconds
