   ch1 = pulseIn(5, HIGH, 25000); // Read the pulse width of 
   ch2 = pulseIn(6, HIGH, 25000); // each channel
   ch3 = pulseIn(7, HIGH, 25000);
+  ch4 = pulseIn(2, HIGH, 25000);
   float bias=0;
-  //Serial.print("CH3=");Serial.println(ch3);
-  if(ch3<1500&&ch3>1490)
+  //Serial.print("CH$=");Serial.println(ch4);
+  if(ch4<1500&&ch3>1490)
     bias=0;
-  if(ch3<=1490)
+  if(ch4<=1490)
     bias=-((ch3-1490)/190.0)*0.8;
-  if(ch3>=1500)
+  if(ch4>=1500)
     bias=((ch3-1500)/200.0)*0.8;
-  //Serial.print("Bias=");Serial.println(bias);
+//  Serial.print("persistantSpeed=");Serial.println(persistantSpeed);
 
   if(ch1<996){ // This sets SWB as the master motor cut off
-    controlMotor(0,0,bias);
+    if(persistantSpeed>0)
+      if(currentRange>10.0)
+        controlMotor(persistantSpeed,persistantDirection,persistantBias,persistantRotation);
+    else {
+      controlMotor(0,0,bias,NO_ROTATION);
+    }
   } else {
      if(ch2<1400){
-        controlMotor(SPEED_FASTER,DIRECTION_BACKWARD,bias);
+        controlMotor(SPEED_FASTER,DIRECTION_BACKWARD,bias,NO_ROTATION);
      }
      if(ch2>=1400&&ch2<1425){
-        controlMotor(SPEED_FAST,DIRECTION_BACKWARD,bias);
+        controlMotor(SPEED_FAST,DIRECTION_BACKWARD,bias,NO_ROTATION);
       }
       if(ch2>=1425&&ch2<1450){
-          controlMotor(SPEED_SLOW,DIRECTION_BACKWARD,bias);
+          controlMotor(SPEED_SLOW,DIRECTION_BACKWARD,bias,NO_ROTATION);
       }
       if(ch2>=1450&&ch2<1500){
-        controlMotor(0,DIRECTION_STOP,bias);
+        controlMotor(0,DIRECTION_STOP,bias,NO_ROTATION);
       }
       if(currentRange>12.0){
         if(ch2>=1500&&ch2<1525){
-            controlMotor(SPEED_SLOW,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_SLOW,DIRECTION_FORWARD,bias,NO_ROTATION);
         }
         if(ch2>=1525&&ch2<1550){
-            controlMotor(SPEED_FAST,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_FAST,DIRECTION_FORWARD,bias,NO_ROTATION);
          }
          if(ch2>=1550&&ch2<1575){
-            controlMotor(SPEED_FASTER,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_FASTER,DIRECTION_FORWARD,bias,NO_ROTATION);
          }
          if(ch2>=1575&&ch2<1600){
-            controlMotor(SPEED_FASTEST,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_FASTEST,DIRECTION_FORWARD,bias,NO_ROTATION);
          }
          if(ch2>=1600&&ch2<1625){
-            controlMotor(SPEED_RIDICULOUS,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_RIDICULOUS,DIRECTION_FORWARD,bias,NO_ROTATION);
          }
          if(ch2>=1625){
-            controlMotor(SPEED_LUDICROUS,DIRECTION_FORWARD,bias);
+            controlMotor(SPEED_LUDICROUS,DIRECTION_FORWARD,bias,NO_ROTATION);
          }
        }
       

  pinMode(5, INPUT); // Set our input pins as such
  pinMode(6, INPUT);
  pinMode(7, INPUT);

  // Set up compass
  Wire.begin();

}

void loop() {
  //Serial.println(".");
  // To drive the motor in H-bridge mode
  // the power chip inputs must be opposite polarity
  // and the Enable input must be HIGH
