   prevHallR = false;
   prevHallL = false;
   state = 11; // at start, movement state is the startup state
+  pastStalled = false;
+  stalled = false;
 }
 
 void loop() {

      prevFlag = cur;
      pivotFlag = false;
      pastNear = false;
    } else if ((cur - prevIR) >= 25) {
      // otherwise, poll all the distance sensors
      prevIR = cur;
      rightDist = sensor.getDist();

          attackCount = 0; // clear attack counter
          state = 0;
          pastNear = true;
        } else if ((expectedVelL > gelVelL() + hallTimeThresh || expectedVelR > getVelR() + hallTimeThresh) && pastStalled && cur - stalled <= stallThresh) {
          past = 'f';
          state = 1;
          attackCount++; // increment attack counter
          pastNear = true;
        } else if (perLeftDist <= near) {
          //if opponent within near of the left peripheral sensor, spin left
          state = 4;
          past = 'l'; // set past movement to left
