   {
     for (byte i = 0; i < modMethod(MAX_INDEX); i++)
     {
-      if ((type != 19 || val != i) && modMethod(PressCount)[i] > 0)
+      if ((type != 19 || val != i) && modMethod(PressTimer)[i] > 0)
       {
-        modMethod(PressTimer)[i] = -1; // signal that the key has fired
-        PressKey(modMethod(GetKeyVal)(i, modMethod(PressCount)[i] - 1), modMethod(GetKeyType)(i, modMethod(PressCount)[i] - 1));
+        modMethod(FireTapDance)(i);
         if (!modMethod(KeyIsDown)[i])
         {
           modMethod(KeyUp)(i, 19);

  {
    if (type == 19)
    {
      // sends the macro sequence with id = val
      ReleaseKey(modMethod(GetKeyVal)(val, modMethod(PressCount)[val] - 1), modMethod(GetKeyType)(val, modMethod(PressCount)[val] - 1));

      // if key has already fired
      if (modMethod(PressTimer)[val] < 0)
      {
        modMethod(PressCount)[val] = 0;
        modMethod(PressTimer)[val] = 0;
      }
      modMethod(KeyIsDown)[val] = false;

    }
  }
}

  {
    if (type == 19)
    {
      if (modMethod(PressCount)[val] < modMethod(MAX_KEYS))
      {
        byte count = ++modMethod(PressCount)[val]; // count gets the *new* count value
        modMethod(PressTimer)[val] = modMethod(GetTimeout)(val) * modMethod(TIMER_MULTIPLIER);
        modMethod(KeyIsDown)[val] = true;

        if (count == modMethod(MAX_KEYS))
        {
          // no more tap dance keys; fire immediately
          modMethod(FireTapDance)(val);
        }
        else
        {
          // check the key that would come after this one
          char tdVal = modMethod(GetKeyVal)(val, count);
          byte tdType = modMethod(GetKeyType)(val, count);

          if (tdVal == 0 && tdType == 0)
          {
            // no more tap dance keys; fire immediately
            modMethod(FireTapDance)(val);
          }
        }
      }
    }
  }
}
