Understanding state machine example

Thanks wildbill. I read several threads on this, I get the point mentioned - always use subtraction when computing time to avoid rollover after 49 days.

use the idiom (a - b > interval)

So this is the problematic code:

  if(millis()>NextAction)

And this fixes it?

  BootTime = millis();  // Capture time at start

...

  CurrentTime = millis();  // Get the current millisecond count
   if (CurrentTime - BootTime > NextAction)