   // If we saw 1 black, it should be in 3, and we have gear 2 in position 2.
   else if (positions_white == 6)
   {
-    if (!photoresistor_history[i][3])
+    if (!photoresistor_history[3])
     {
       gear_types[i] = 2;
       gear_orientations[i] = 1;

  for (int i=0; i<3; i++)
  {
    Serial.print(" ");
    Serial.print(getPhotoresistor(i));
    Serial.print(" (");
    Serial.print(analogRead(photoresistors[i]));
    Serial.print(")");

    {
      // We have started calibrating!
      state = 1;
      // initialize photoresistor data.
      for (int i=0; i<3; i++)
      {
        for (int j=0; j<7; j++)
        {
          photoresistor_totals[i][j] = 0;
          photoresistor_counts[i][j] = 0;
        }
      }
    }
  }

