   lasttouched = currtouched;
 }
 
+
 void checkTouch() {
   for (uint8_t i=0; i < 12; i++) {
-    // it if *is* touched and *wasnt* touched before, alert!
+    // it if /is/ touched and /wasn't/ touched before, alert!
     if ( (currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) touchHandler(i);
 
-    // if it *was* touched and now *isnt*, alert!
+    // if it /was/ touched and now /isn't/, alert!
     if ( !(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) releaseHandler(i);
   } 
 }
 
+
 void touchHandler(int id) {
+  Serial.print(id); Serial.println(" touched");
+  
+  switch(id) {
+    case MOUSE_LEFT_PIN:
+      Mouse.press(MOUSE_LEFT);
+      break;
+    case MOUSE_MID_PIN:
+      Mouse.press(MOUSE_MIDDLE);
+      break;
+    case MOUSE_RIGHT_PIN:
+      Mouse.press(MOUSE_RIGHT);
+      break;
+  }
+}
+
+
+void releaseHandler(int id) {
   Serial.print(id); Serial.println(" released");
-}
-
-void releaseHandler(int id) {
-  Serial.print(id); Serial.println(" touched");
-}
+    
+  switch(id) {
+    case MOUSE_LEFT_PIN:
+      Mouse.release(MOUSE_LEFT);
+      break;
+    case MOUSE_MID_PIN:
+      Mouse.release(MOUSE_MIDDLE);
+      break;
+    case MOUSE_RIGHT_PIN:
+      Mouse.release(MOUSE_RIGHT);
+      break;
+  }
+}
+
 
 void calibrate(float x, float y) {
    xRange[0] = min(xRange[0], x);

   Serial.print(yRange[0]); Serial.print(", "); Serial.println(yRange[1]);
}

float clamp(float value, float min_, float max_) {
  return (value < min_) ? min_ : (value > max_) ? max_ : value;
}

void displaySensorDetails(void) {
  sensor_t accel, mag, gyro, temp;

  lsm.getEvent(&accel, &mag, &gyro, &temp);  
}


void dof_loop() {
  /* Get a new sensor event */
  sensors_event_t accel, mag, gyro, temp;
