 
 while(followdirection >= 9)
 {
-  if (frontultrasonic.getdistance() > closeToWall && lefttultrasonic.getdistance() < closeToWall)
+  if (frontultrasonic.getDistance() > closeToWall && lefttultrasonic.getDistance() < closeToWall)
   {
     moveSlightRight();
     delay(500);    //move left diagnal
-    moveSlightLeft().wait(leftultrasonic.getdistance() < closeToWall);
+    moveSlightLeft().wait(leftultrasonic.getDistance() < closeToWall);
     delay(500);
   }
 
-  else if (leftultrasonic.getdistance() > 2 && frontultrasonic.getdistance() > 2)
+  else if (leftultrasonic.getDistance() > 2 && frontultrasonic.getDistance() > 2)
   {
     turn(90);
     delay(500);
     followdirection = followdirection + 1;
   }
-  else if (leftultrasonic.getdistance() < 2 && frontultrasonic.getdistance() < 2)
+  else if (leftultrasonic.getDistance() < 2 && frontultrasonic.getDistance() < 2)
   {
     turn(-90);
     delay(500);


while(followdirection < 7)
{
  if (frontultrasonic.getdistance() > 2 && rightultrasonic.getdistance() < 2)
  {
    moveSlightLeft();
    delay(500);         //move left diagnal
    moveSlightRight().wait(rightultrasonic.getdistance() < 2);
    delay(500);    //move diagnol towards the wall until your close to the wall
  }

  else if(rightultrasonic.getdistance() > 2 && frontultrasonic.getdistance() > 2)
  {
    turn(-90);    //if there is no right wall turn right
    delay(500);
    followdirection = followdirection +1;
  }

  else if(rightultrasonic.getdistance() < 2 && frontultrasonic.getdistance() < 2)
  {
    turn(90);
    delay(500)


while(followdirection >= 7)
{
  if (frontultrasonic.getDistance() > closeToWall && lefttultrasonic.getDistance() < closeToWall)
  {
    moveSlightRight();
    delay(500);    //move left diagnal
    moveSlightLeft().wait(leftultrasonic.getDistance() < closeToWall);
    delay(500);
  }

  else if (leftultrasonic.getDistance() > 2)
  {
    moveright();    //if there is no left wall turn left
    delay(500);
    followdirection = followdirection + 1;
  }
  else if (frontultrasonic.getDistance() < lowerleftroomdistance)
  {
    followdirection = followdirection + 1;
  }
