   
   // Update the recorded motor positions
   for (int i = 0; i < ROTARY_COUNT; i++) {
-    positions[i] += (int8_t) Wire.read();  // Must cast to signed 8-bit type
+
+    // another integer array OU (over/uder 0-30000)
+    if(positions[i] > 30000){
+      int temp = positions[i];
+      int remendier = temp - 30000;
+      positions[i] = remendier;
+      UO[i] += 1;      
+    }
+
+    if(positions[i] < -30000 && positions[i] < 0){
+      int temp = positions[i];
+      int remendier = temp + 30000;
+      positions[i] = remendier;
+      UO[i] -= 1;
+    }
+    
+    int r = (int) ((int8_t) Wire.read());  // Must cast to signed 8-bit type
+    positions[i] += (r*-1);
+    rotations[i] = (r*-1);
+
+    
   }
 }
 

  motorAllStop(); // use this for now, can change later

  // set motors for right rotation
  motorForward(FRONT_LEFT_MOTOR, power);
  motorBackward(TURNING_MOTOR, power);

  // send reply message
  Serial.println("Robot right");

    Serial.print(positions[i]);
    Serial.print(' ');
  }
  Serial.print("                      ");
  Serial.print("UO: ");
  for (int i = 0; i < ROTARY_COUNT; i++) {
    Serial.print(UO[i]);
    Serial.print(' ');
  }
  Serial.print("                       ");
  Serial.print("rotations: ");
  for (int i = 0; i < ROTARY_COUNT; i++) {
    Serial.print(rotations[i]);
    Serial.print(' ');
  }
  Serial.println();
  delay(PRINT_DELAY);  // Delay to avoid flooding serial out
}
