   }
   turnMotor4(35, 7);
   turnCubeStraight();
+  detachInterrupt (0);
+  verifyScannedSide();
 }
 
 
 //Method to add the scanned side to the common scanCube variable
-void addSideToScanCubeString(String cubeSide[9]) {
+void addSideToScanCubeString() {
   for (byte i=0; i<9; i++) {
-    ScannedCube += SideScanResult[i];
-  }
-  //Serial.println(ScannedCube);
+    ScannedCube[cubeCounter] = SideScanResult[i];
+    cubeCounter ++;
+  }
+  Serial.println(ScannedCube); ////////////////////////////////////////////////////////////////////////
 }
 
 

  byte r_count = 0;
  byte g_count = 0;
  byte b_count = 0;
  if (scannedCube.length() != 54) {scanErrorFlag = true;}
  else {
    for (byte i=0; i<54; i++) {
      if (String(scannedCube[i]) == "w") {w_count++;}
      else if (String(scannedCube[i]) == "y") {y_count++;}
      else if (String(scannedCube[i]) == "o") {o_count++;}
      else if (String(scannedCube[i]) == "r") {r_count++;}
      else if (String(scannedCube[i]) == "g") {g_count++;}
      else if (String(scannedCube[i]) == "b") {b_count++;}
      else {scanErrorFlag = true;}
    }
    if ((w_count != 9) || (y_count != 9) || (o_count != 9) || (r_count != 9) || (g_count != 9) || (b_count != 9)) {scanErrorFlag = true;}
  }

  if (scanErrorFlag == true) {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Scan error");
    lcd.setCursor(0, 1);
    lcd.print("Repeat scan");
  }
  else {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Scan completed");
    lcd.setCursor(0, 1);
    lcd.print("successfully");
    Serial.println(ScannedCube);
  }
  
}

//Method for caibration scan of one side - scan each item once and print the RGB values
void calibrationScan() {
  attachInterrupt (0, leftButtonPressed, FALLING);
  operateFlag = true;
  turnMotor2(95, 5);
  delay(200);
  turnMotor4(35, 7);
  delay(200);
  for (int i = 0; i<9; i++) {
    turnMotor1(Motor_1_ScanAngles[i], 4);
    turnMotor4(Motor_4_ScanAngles[i], 7);
    delay(200);
    calibrate();
    delay(200);
  }
  turnMotor4(35, 7);
  turnCubeStraight();
}




//Method for assembling cube based on the steps string
void assembleCube(String movementString) {
  byte solutionLength = movementString.length();
  for (byte i=0; i<=solutionLength; i++) {
    String stepValue = String(movementString[i]);
    Serial.println(stepValue);

    //Print process on LCD
    /*lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(F("Assembling cube"));
    lcd.setCursor(0, 1);
    lcd.print("Step   ( ) of ");
    lcd.setCursor(5, 1);
