     while( frac1 /= 10 )
       padding--;
     while(  padding--)
-      slcd.print("0");
-    slcd.print(frac,DEC) ;
-  }
-}
-
-void rightLimitHandler() {
+      lcd.print("0");
+    lcd.print(frac,DEC) ;
+  }
+}
+
+
+//***************** MOTOR HANDLING *************************
+
+void rightLimitHandler() { //this controld the behavior of the system when the RIGHT limit switch is HIGH.
   // placeholder
 }
 
-void leftlimit() {
+void leftlimit() { //this controld the behavior of the system when the LEFT limit switch is HIGH.
   //placeholder
+}
+
+/*
+void stopMotor(){ //This is to stop the motor
+  digitalWrite(CWpin, LOW); 
+  digitalWrite(CCWpin, LOW);
+}
+*/
+
+void slewMenuControl() { //this is the action code for slew mode.
+
+}
+
+void jogMenuControl() { //This is the action code for jog mode
+
+  boolean rightRed_b = digitalRead(rightRed);
+  boolean leftRed_b = digitalRead(leftRed);
+
+  if (left_Rb.isHit()) {
+    testVar++;
+    lcd.setCursor(8, 1);
+    lcd.print("<--");
+    refreshScreen = 1;
+  }
+  else if (right_Rb.isHit()) {
+    testVar++;
+    lcd.setCursor(8, 1);
+    lcd.print("-->");
+    refreshScreen = 1;
+  }
+  else {
+    testVar = 0;
+  }
+  if (refreshScreen == 1 && !rightRed_b && !leftRed_b) {
+    noClearBottom();
+    refreshScreen = 0;
+  }
+
+  lcd.setCursor(12, 1);
+  lcd.print(testVar, DEC);
+  lcd.setCursor(0, 1);
+  lcd.print(refreshScreen, DEC);
 }

void setup() { //int yer inpins

  pinMode(inPin1, INPUT); 
  pinMode(inPin2, INPUT);
  pinMode(inPin3, INPUT);
  pinMode(inPin4, INPUT);
  pinMode(inPin5, INPUT);
  pinMode(inPin6, INPUT);
  
  Serial.begin(9600);
  slcd.begin();
  slcd.backlight();
}

void loop() { //high speed code goes here

  return OK;
}

void noClear() { //prints blanks to the screen, looks way better that using lcd.clear().
  lcd.setCursor(0,0);
  lcd.print("                ");
  lcd.setCursor(0,1);
  lcd.print("                ");
}

void noClearBottom() { //does the same as noClear but only clears the bottom row.
  lcd.setCursor(0,1);
  lcd.print("                ");
}

void lcdPrintDouble( double val, byte precision, int row, int col){ // example: printDouble( 3.1415, 2, 0, 1); // prints 3.14 (two decimal places)
  // prints val on a ver 0012 text lcd with number of decimal places determine by precision
  // precision is a number from 0 to 6 indicating the desired decimial places
  // example: printDouble( 3.1415, 2); // prints 3.14 (two decimal places)
  lcd.setCursor(row,col);

  if(val < 0.0){
    lcd.print('-');
    val = -val;
  }

  lcd.print (val,DEC);  //prints the int part
  if( precision > 0) {
    lcd.print("."); // print the decimal point
    unsigned long frac;
    unsigned long mult = 1;
    byte padding = precision -1;
