 #define MAINTENANCE 6 // Maintenance mode.
 #define ALARM       7 // Alarm mode.
 
-#define IN     INPUT_PULLUP  // INPUT or INPUT_PULLUP
-#define BUTTON INPUT_PULLUP  // INPUT or INPUT_PULLUP
-#define SENSOR INPUT_PULLUP  // INPUT or INPUT_PULLUP
-#define OUT    OUTPUT
-#define ON     HIGH
-#define OFF    LOW
+#define      ON            HIGH
+#define     OFF            LOW
+#define      IN(x)         pinMode(x, INPUT_PULLUP)
+#define  BUTTON(x)         pinMode(x, INPUT_PULLUP)
+#define  SENSOR(x)         pinMode(x, INPUT_PULLUP)
+#define     OUT(x)         pinMode(x, OUTPUT)
 #define BETWEEN(x, a, b)  ((a) <= (x) && (x) <= (b))
-#define isON(x)           (digitalRead(x) == ON)
-#define isOFF(x)          (digitalRead(x) == OFF)
-#define turnON(x)         if (isOFF(x)) {digitalWrite(x, ON);}
+#define    isON(x)        (digitalRead(x) == ON)
+#define   isOFF(x)        (digitalRead(x) == OFF)
+#define  turnON(x)        if (isOFF(x)) {digitalWrite(x, ON);}
 #define turnOFF(x)        if  (isON(x)) {digitalWrite(x, OFF);}
 #define ButtonState(x)    digitalWrite(x.out, x.button.state())
-#define LedState(x)       digitalWrite(x.led, x.button.state())
+#define    LedState(x)    digitalWrite(x.led, x.button.state())
 
 Modus modes(7);
 Cyclic cycle(2000, 900);
 
 void setup() {
   // BUTTONS
-  pinMode(general.in, BUTTON);
-  pinMode(dater.in, BUTTON);
-  pinMode(feeder.in, BUTTON);
+  BUTTON(general.in);
+  BUTTON(dater.in);
+  BUTTON(feeder.in);
   // SENSORS
-  pinMode(sensor.reset, SENSOR);
-  pinMode(sensor.photocell, SENSOR);
-  pinMode(sensor.security1, SENSOR);
-  pinMode(sensor.security2, SENSOR);
-  pinMode(sensor.security3, SENSOR);
-
-  // OTHER
-  pinMode(vWelder.out, OUT);
-  pinMode(hWelder.out, OUT);
-  pinMode(dWelder.out, OUT);
-  pinMode(general.out, OUT);
-  pinMode(feeder.out, OUT);
-  pinMode(dater.out, OUT);
-  pinMode(dater.led, OUT);
-  pinMode(jaw.out, OUT);
-  pinMode(photocell.out, OUT);
-  pinMode(knife.out, OUT);
-  pinMode(cooler.out, OUT);
-  pinMode(welder.out, OUT);
-
-  // Shut OFF at startup
+  SENSOR(sensor.reset);
+  SENSOR(sensor.photocell);
+  SENSOR(sensor.jaw);
+  SENSOR(sensor.security1);
+  SENSOR(sensor.security2);
+  SENSOR(sensor.security3);
+
+  // OUTPUTS
+  OUT(vWelder.out);
+  OUT(hWelder.out);
+  OUT(dWelder.out);
+  OUT(general.out);
+  OUT(feeder.out);
+  OUT(dater.out);
+  OUT(dater.led);
+  OUT(jaw.out);
+  OUT(photocell.out);
+  OUT(knife.out);
+  OUT(cooler.out);
+  OUT(welder.out);
+
+  // Shut all outputs OFF at startup
   allOFF();
 }
 

  }
}

void reset() {
  if (isOFF(sensor.reset)) { // If reset sensor is pressed. (PULLUP)
    cycle.reset(); // Resets the cycle;
  }
}

void weldersPWM() {
  !vWelder.lock ? vWelder.pwm.on() : vWelder.pwm.off();

  turnOFF(welder.out);
}

void updateAll() { cycle.update(); }

void Schedule(struct function f) {
  isON(dater.led) ? dater.lock = false : dater.lock = true;
  unsigned long start;
  f.start == 0 ? start = 0 : start = (f.start * cycle.last()) / jaw.stop;
  unsigned long stop;
  f.stop == 0 ? stop = 0 : stop = (f.stop * cycle.last()) / jaw.stop;
  if (f.lock) { // Locked function?
    if (isON(f.out)) { turnOFF(f.out); }
  } else { // Unlocked function.
    if (start < stop && BETWEEN(cycle.now(), start, stop)) {
