 // =================================================================================
 void setup()
 {
-  // Attach interruption to encoders channels
-  attachInterrupt(0, ISR_HANDLER_X, CHANGE);
-  attachInterrupt(1, ISR_HANDLER_X, CHANGE);
-  attachInterrupt(2, ISR_HANDLER_Y, CHANGE);
-  attachInterrupt(3, ISR_HANDLER_Y, CHANGE);
-  
-  // Start the mouse function
-  Mouse.begin();
+    // Attach interruption to encoders channels
+    attachInterrupt(0, ISR_HANDLER_X, CHANGE);
+    attachInterrupt(1, ISR_HANDLER_X, CHANGE);
+    attachInterrupt(2, ISR_HANDLER_Y, CHANGE);
+    attachInterrupt(3, ISR_HANDLER_Y, CHANGE);
+
+    // Start the mouse function
+    Mouse.begin();
 }
 
 // =================================================================================

// =================================================================================
void ISR_HANDLER_X()
{
  // Build the LUT index from previous and new data
  xAxis.index       = (xAxis.index << 2) | ((PIND & 0b00000011) >> 0);
  xAxis.coordinate += lookupTable[xAxis.index & 0b00001111];
}

void ISR_HANDLER_Y()
{
  // Build the LUT index from previous and new data
  yAxis.index       = (yAxis.index << 2) | ((PIND & 0b00001100) >> 2);
  yAxis.coordinate += lookupTable[yAxis.index & 0b00001111];
}

// =================================================================================

// =================================================================================
void loop()
{
    // Update mouse coordinates
    if (xAxis.coordinate != 0 || yAxis.coordinate != 0)
    {
        Mouse.move(xAxis.coordinate, yAxis.coordinate);
        xAxis.coordinate = 0;
        yAxis.coordinate = 0;
    }

    // ---------------------------------
    // Left mouse button state update
    // ---------------------------------
    ReadButton(leftButton);
    UpdateButton(leftButton);

    // ---------------------------------
    // Right mouse button state update
    // ---------------------------------
    ReadButton(rightButton);
    UpdateButton(rightButton);

    // ---------------------------------
    // Middle mouse button state update
    // ---------------------------------
    ReadButton(middleButton);
    UpdateButton(middleButton);

    // Wait a little before next update
    delay(10);
}

// =================================================================================
