 // -------------------------
 void ISR_TACH()
 {
-  int duration = (int)(micros() - tachLast);
-  if (duration < 0)
+  unsigned long duration;
+  unsigned long current = micros();
+  
+  if (current >= tachLast)
+  {
+    duration = current - tachLast;
+  }
+  else
   {
     //Handle Rollover
-    duration = 0xFFFFFFFFu - tachLast + micros();
-  }
+    //duration = 0xFFFFFFFFu - tachLast + current;
+  }
+  
   //Shift the values
   tachDuration2 = tachDuration1;
   tachDuration1 = tachDuration0;
   tachDuration0 = duration;
   
-  tachLast = micros();
+  tachLast = current;
   
   //Calculate RPM
   //rpm = getRPM();

  attachInterrupt(TACH_PIN - 2, ISR_TACH, RISING);
  attachInterrupt(ACTIVATION_PIN - 2, ISR_ACTIVE, CHANGE);
  
  Timer1.initialize(1000000);
  Timer1.stop();
  Timer1.attachInterrupt(ISR_IGNITION);
  
  if (debug)
  {

// -------------------------
volatile bool active = false;
unsigned int rpm = 0;
volatile unsigned long tachDuration0 = 0;
volatile unsigned long tachDuration1 = 0;
volatile unsigned long tachDuration2 = 0;
volatile unsigned long tachLast = 0;
volatile unsigned int ignitionMode = OFF;
volatile int remainingCount = 0;
volatile bool updateTimer = false;
long period = 0;

// -------------------------
