 const int readyLED = A0;
 const int armButton = 2;
 boolean armed = false;
-float sensorError[2] = {0, 0};
+
+struct SensorError {
+  float pitch;
+  float roll;
+};
+SensorError sensorError = {0, 0};
 boolean calibrating = true;
 
 Adafruit_10DOF                dof   = Adafruit_10DOF();

  const unsigned short trials = 20;
  for (int trial = 0; trial < trials; trial++) {
    sensors_vec_t sensorData = getOrientation();
    sensorError[0] += (float)sensorData.pitch;
    sensorError[1] += (float)sensorData.roll;
    delay(20);
  }
  sensorError[0] /= trials;
  sensorError[1] /= trials;
  calibrating = false;
  
  digitalWrite(armLED, HIGH);

  orientation.roll = -orientation.pitch;
  orientation.pitch = roll;
  if (!calibrating) {
    orientation.pitch -= sensorError.pitch;
    orientation.roll -= sensorError.roll;
  }
  orientation.heading = -orientation.heading;
  return orientation;
