  * reliable.
  */
 
-#define SPEED 200 // maximum motor speed when turning or going straight
-
-#define CALIB_SAMPLES 70
-#define CRA_REG_M_220HZ 0x1C // CRA_REG_M value for magnetometer 220 Hz update rate
-
-// allowed deviation (in degrees) relative to target angle that must be achieved before driving straight
-#define DEVIATE_THRESHOLD 5
-
-#define DEVIATE_RIGHT_THRESHOLD   DEVIATE_THRESHOLD
-#define DEVIATE_LEFT_THRESHOLD    (360 - DEVIATE_THRESHOLD)
-
-/* Public variables that may be used for compass are:
- * m_min - minimum magnetic vector
- * m_max - maximum magnetic vector
- * m     - magnetic vector
- * a     - acceleration vector
- */
+#define SPEED 200 // Maximum motor speed when turning or going straight
+
+#define CALIBRATION_SAMPLES 70  // Number of compass readings to take when calibrating
+#define CRA_REG_M_220HZ 0x1C    // CRA_REG_M value for magnetometer 220 Hz update rate
+
+// Allowed deviation (in degrees) relative to target angle that must be achieved before driving straight
+#define DEVIATION_THRESHOLD 5
+
+#define DEVIATION_RIGHT_THRESHOLD   DEVIATION_THRESHOLD
+#define DEVIATION_LEFT_THRESHOLD    (360 - DEVIATION_THRESHOLD)
 
 ZumoMotors motors;
 Pushbutton button(ZUMO_BUTTON);
 LSM303 compass;
 
-// Setup will calibrate our compass
-// We calibrate by finding maximum/minimum magnetic readings
+// Setup will calibrate our compass by finding maximum/minimum magnetic readings
 void setup()
 {
   // The highest possible magnetic value to read in any direction is 2047

  avg.x /= 10.0;
  avg.y /= 10.0;

  // avg is the average measure of the north vector.
  return heading(avg);
}

void loop()
{
  int heading, relative_heading;
  static int target_heading = averageHeading();

  // Heading is given in degrees away from North, increasing clockwise
  heading = averageHeading();

  // This gives us the relative heading with respect to the target angle
  relative_heading = relativeHeading(target_heading, heading);

  Serial.print("Target heading: ");
  Serial.print(target_heading);
  Serial.print("    Actual heading: ");
  Serial.print(heading);
  Serial.print("    Difference: ");
  Serial.print(relative_heading);

  // If the Zumo has turned to the direction it wants to be pointing, go straight and then do another turn
  if((relative_heading < DEVIATION_RIGHT_THRESHOLD) || (relative_heading > DEVIATION_LEFT_THRESHOLD))
  {
    motors.setSpeeds(SPEED, SPEED);

