   delayMicroseconds(50);
   while (digitalRead(MCLK) == HIGH)
     ;
-  Serial.print("Switch mode1");
+
+  gohi(MDATA);
     
   /* wait for mouse to switch modes */
   while ((digitalRead(MCLK) == LOW) || (digitalRead(MDATA) == LOW))
     ;
-
-  Serial.print("Switch mode2");
     
   /* put a hold on the incoming data. */
   golo(MCLK);

   
  gohi(MCLK);
  gohi(MDATA);
    Serial.println("Sending reset to mouse\n");
  mouse_write(0xff);
    Serial.println("mouse_write");
  mouse_read();  /* ack byte */
    Serial.print("Read ack byte1\n");
  mouse_read();  /* blank */
  mouse_read();  /* blank */
    Serial.print("Setting sample rate 200\n");
  mouse_write(0xf3);  /* Set rate command */
  mouse_read();  /* ack */
  mouse_write(0xC8);  /* Set rate command */
  mouse_read();  /* ack */
    Serial.print("Setting sample rate 100\n");
  mouse_write(0xf3);  /* Set rate command */
  mouse_read();  /* ack */
  mouse_write(0x64);  /* Set rate command */
  mouse_read();  /* ack */
    Serial.print("Setting sample rate 80\n");
  mouse_write(0xf3);  /* Set rate command */
  mouse_read();  /* ack */
  mouse_write(0x50);  /* Set rate command */
  mouse_read();  /* ack */
    Serial.print("Read device type\n");
  mouse_write(0xf2);  /* Set rate command */
  mouse_read();  /* ack */
  mouse_read();  /* mouse id, if this value is 0x00 mouse is standard, if it is 0x03 mouse is Intellimouse */
    Serial.print("Setting wheel\n");
  mouse_write(0xe8);  /* Set wheel resolution */
  mouse_read();  /* ack */
  mouse_write(0x03);  /* 8 counts per mm */

 * Pin 5 is the mouse data pin, pin 6 is the clock pin
 * Feel free to use whatever pins are convenient.
 */
#define MDATA A0
#define MCLK A1

/*
 * according to some code I saw, these functions will
