 
   if ((cur - prevLine) >= 5) {
     prevLine = cur;
-    if ((analogRead(backleft) < threshold || analogRead(backright) < threshold) && lineFlag != 1) {
+    if ((analogRead(BL) < threshold || analogRead(BR) < threshold) && lineFlag != 1) {
       //if line detected by back line sensors and wasn't detected before, go forward
       state = 0;
       lineFlag = 1; // set line flag state
       prevFlag = cur;
       pivotFlag = false;
       pastNear = false;
-    } else if (analogRead(frontleft) < threshold && past == 'l' && lineFlag != 2) {
+    } else if (analogRead(FL) < threshold && past == 'l' && lineFlag != 2) {
       // if past left and front left hits line and wasn't hit before, turn back right, spin left
       state = 6;
       lineFlag = 2; // set line flag state
       prevFlag = cur;
       pivotFlag = false;
       pastNear = false;
-    } else if (analogRead(frontleft) < threshold && past == 'r' || analogRead(frontleft) < threshold && past == 'f' && lineFlag != 3) {
+    } else if (analogRead(FL) < threshold && past == 'r' || analogRead(FL) < threshold && past == 'f' && lineFlag != 3) {
       // if past right or forward and front left hits line and wasn't hit before, turn back right, spin right
       state = 7;
       lineFlag = 3; // set line flag state
       prevFlag = cur;
       pivotFlag = false;
       pastNear = false;
-    } else if (analogRead(frontright) < threshold && past == 'l' && lineFlag != 4) {
+    } else if (analogRead(FR) < threshold && past == 'l' && lineFlag != 4) {
       // if past left and front right hits line and wasn't hit before, turn back left, spin right
       state = 8;
       lineFlag = 4; // set line flag state
       prevFlag = cur;
       pivotFlag = false;
       pastNear = false;
-    } else if (analogRead(frontright) < threshold && past == 'r' || analogRead(frontright) < threshold && past == 'f' && lineFlag != 5) {
+    } else if (analogRead(FR) < threshold && past == 'r' || analogRead(FR) < threshold && past == 'f' && lineFlag != 5) {
       // if past right or forward and front right hits line and wasn't hit before, turn back left, spin left
       state = 9;
       lineFlag = 5; // set line flag state
       prevFlag = cur;
       pivotFlag = false;
       pastNear = false;
-    } else if (analogRead(frontright) < threshold && analogRead(frontleft) < threshold && lineFlag != 6) {
+    } else if (analogRead(FR) < threshold && analogRead(FL) < threshold && lineFlag != 6) {
       // if both front corners hits line and wasn't hit before, go back and spin 180 degrees
       state = 10;
       lineFlag = 6; // set line flag state

  if ((cur - prevIR) >= 25) {
      // otherwise, poll all the distance sensors
      prevIR = cur;
      rightDist = sensor.getDist();
      leftDist = sensor2.getDist();
      perRightDist = sideright.getDist();
      perLeftDist = sideleft.getDist();

      //attack code with sensors
      if (expectedVelL > getVelL() + hallTimeThresh || expectedVelR > getVelR() + hallTimeThresh) {

int arrPosL;
bool pastStalled;
int stalled;
int initial;

// thresholds for distance sensors
int near = 200;
