 
   readSensors();
 
+  // if the right sensor is the only sensor that have the value 1, the bot need to compensate by turning right
+  if((leftSensor == 0 && middleSensor == 0 && rightSensor == 1))
+  {
+    steerRight();
+    Serial.println("SteerLeft");
+    lastAction = 2;
+  }
+  // if the left sensor is the only sensor that have the value 1, the bot need to compensate by turning left
+  else if((leftSensor == 1 && middleSensor == 0 && rightSensor == 0))
+  {
+    steerLeft();
+    Serial.println("SteerRight");
+    lastAction = 3;
+  }
   // if sensor value = 1, then the sensor is on track
   if((leftSensor == 0 && middleSensor == 1 && rightSensor == 0))
   {
     fwd();
     Serial.println("Forward");
     lastAction = 1;
-  }
-  // if the right sensor is the only sensor that have the value 1, the bot need to compensate by turning right
-  else if((leftSensor == 0 && middleSensor == 0 && rightSensor == 1))
-  {
-    steerLeft();
-    Serial.println("SteerLeft");
-    lastAction = 2;
-  }
-  // if the left sensor is the only sensor that have the value 1, the bot need to compensate by turning left
-  else if((leftSensor == 1 && middleSensor == 0 && rightSensor == 0))
-  {
-    steerRight();
-    Serial.println("SteerRight");
-    lastAction = 3;
   }
   else
   {

void fwd(){
  Motors.runMotor(1,FORWARD,speedVal);
  Motors.runMotor(2,FORWARD,speedVal);
}
void rev(){
  Motors.runMotor(1,BACKWARD,speedVal);
  Motors.runMotor(2,BACKWARD,speedVal);
}
void stop(){
  Motors.runMotor(1,FORWARD,0);
  Motors.runMotor(2,FORWARD,0);
}
void steerRight(){
  Motors.runMotor(1,FORWARD,speedVal*turnMulti);
  Motors.runMotor(2,FORWARD,speedVal);
}
void steerLeft(){
  Motors.runMotor(1,FORWARD,speedVal);
  Motors.runMotor(2,FORWARD,speedVal*turnMulti);
}
void turnLeft(){  // Turn 90 degree LEFT
  Motors.runMotor(1,BACKWARD,speedVal);

int lastAction = 0;

// Variable that works as a factor regulating the turn speed. i.e 1.8*spedVal = turnspeed
float turnMulti = 1.6;

int loopDelay = 0;

