 }
 
 /**
-   Method to scan the values of all the inputs of the shiftregisters
-*/
+ * Method to scan the values of all the inputs of the shiftregisters
+ */
 void scanRows() {
-  if(debug){
-    Serial.println("Scanning rows start");
-    Serial.print("Load pin: ");
-    Serial.println(loadPin);
-    Serial.print("inEnPin pin: ");
-    Serial.println(inEnPin);
-    Serial.print("inReadPin pin: ");
-    Serial.println(inReadPin);
-    delay(10);
-  }
+#ifdef debug 
+  Serial.println("Scanning rows start");
+  Serial.print("Load pin: ");
+  Serial.println(loadPin);
+  Serial.print("inEnPin pin: ");
+  Serial.println(inEnPin);
+  Serial.print("inReadPin pin: ");
+  Serial.println(inReadPin);
+  delay(10);
+#endif
   digitalWrite(loadPin, LOW); //On Low the parallel data is collected
   delayMicroseconds(5);
   digitalWrite(loadPin, HIGH); //On HIGH is read ready

}

/**
    Method to send a note off message.
    @param pChannel the channel to send the noteoff.
    @param pPitch the note to turn off.
 */
void noteOff(byte pChannel, byte pPitch){
  pChannel += noteOFF-1;

  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(outClkPin, OUTPUT);
  //Set the enabler pins to outputs.
  for (i = 0; i < sizeof(muxEn) / sizeof(int); i++) {
    pinMode(muxEn[i], OUTPUT);
  }
  //Set the note times to 0
  for (i = 0; i < sizeof(noteTime) / sizeof(long); i++) {
    noteTime[i] = 0;
  }
  //Set all the notes as off
  for (i = 0; i < sizeof(keyState) / sizeof(bool); i++) {
    keyState[i] = 0;
  }
  //Set all the row read values to false
  for (i = 0; i < keyRows+buttonRows; i++){
    rowsRead[i] = false;
  }
  //Set all the buttons of the pad to off.
  for (i = 0; i < padColumns*padRows; i++){
    padState[i] = 0;
  }
  //Set all the buttons of the pad to off.
  for (i = 0; i < buttonRows*buttonColumns; i++){
    buttonState[i] = 0;
  }

  readAnalog(); //Read the initial value of the knobs
  transpose(trans); //Set the octave to the initial value.
  digitalWrite(loadPin, HIGH); //On HIGH is read ready
  delay(1000); //Waits a second.
#ifdef debug 
  Serial.println("Setup Ready");
#endif
}

/**
 * Method to select a pin of a mux
 * @param pPin: the mux pin that you want to write or read.
 * @param pMuxEn: the pin of the mux that you want to read from.
 * @return void
 */
void muxToPin(byte pPin, byte pMuxEn) {
  sValue[0] = bitRead(pPin, 0);
  sValue[1] = bitRead(pPin, 1);
