 
 void loop()
 {
-  //------------------------------------------------------------ Check battery voltage and current draw of motors ---------------------
-
-  Volts=analogRead(Battery);                                  // read the battery voltage
-  LeftAmps=analogRead(LmotorC);                               // read left motor current draw
-  RightAmps=analogRead(RmotorC);                              // read right motor current draw
+  //
+  // Check battery voltage and current draw of motors
+  //
+
+  // read the battery voltage
+  Volts=analogRead(Battery);
+
+  // read left motor current draw
+  LeftAmps=analogRead(LmotorC);
+
+  // read right motor current draw
+  RightAmps=analogRead(RmotorC);
 
   //Serial.print(LeftAmps);
   //Serial.print("    ");

    {
      if ((highVolts-Volts)>5 || (millis()-chargeTimer)>chargetimeout) // has voltage begun to drop or levelled out?
      {
        Charged=1;                                            // battery voltage has peaked
        digitalWrite(Charger,1);                             // turn off current regulator
        
        Serial.print("Charge complete after ");
        Serial.print((millis()-chargeStart)*1000 / 60);
        Serial.print(":");
        Serial.print((millis()-chargeStart)*1000 % 60);
        Serial.println("!");
        
        logBatteryVoltage();
      }
    } 
  }

  else

  {//----------------------------------------------------------- GOOD BATTERY speed controller opperates normally ----------------------

    switch(Cmode)
    {
    case 0:                                                   // RC mode via D0 and D1
      RCmode();
      break;

    case 1:                                                   // Serial mode via D0(RX) and D1(TX)
      SCmode();
      break;

    case 2:                                                   // I2C mode via A4(SDA) and A5(SCL)
      I2Cmode();
      break;
    }

    // --------------------------------------------------------- Code to drive dual "H" bridges --------------------------------------

    if (Charged==1)                                           // Only power motors if battery voltage is good
    {
      if ((millis()-leftoverload)>overloadtime)             
      {
        switch (Leftmode)                                     // if left motor has not overloaded recently
        {

int Rightspeed=0;
int Speed;
int Steer;
// 0=Flat battery  1=Charged battery
byte Charged=1;
// 0=reverse, 1=brake, 2=forward
int Leftmode=1;
// 0=reverse, 1=brake, 2=forward
int Rightmode=1;
// PWM value for left  motor speed / brake
int LeftPWM;
// PWM value for right motor speed / brake
int RightPWM;
int data;
int servo[7];

//
// define servos
//
Servo Servo0;
Servo Servo1;
Servo Servo2;
Servo Servo3;
Servo Servo4;
Servo Servo5;
Servo Servo6;

void setup()
{
  //
  // Attach servos to I/O pins
  //
  Servo0.attach(S0);
  Servo1.attach(S1);
  Servo2.attach(S2);
  Servo3.attach(S3);
  Servo4.attach(S4);
  Servo5.attach(S5);
  Servo6.attach(S6);

  //
  // Set servos to default position
  //
  Servo0.writeMicroseconds(DServo0);
  Servo1.writeMicroseconds(DServo1);
  Servo2.writeMicroseconds(DServo2);
  Servo3.writeMicroseconds(DServo3);
  Servo4.writeMicroseconds(DServo4);
  Servo5.writeMicroseconds(DServo5);
  Servo6.writeMicroseconds(DServo6);

  //
  // Initialize I/O pins
  //

  // Change charger pin to output
  pinMode(Charger, OUTPUT);

  // Disable current regulator to charge battery
  digitalWrite(Charger, 1);

  if (Cmode==1)
  {
    // enable serial communications if Cmode=1
    Serial.begin(Brate);

    // flush buffer
    Serial.flush();
  }
  else {
    // Enable regardless for logging
    Serial.begin(Brate);
  }

  Serial.print("Wild Thumper started in ");
  switch(Cmode) {
    case 0:
