Each document acts like a state machine where there is a single state label indicating the major state of the document. The rest of the document is consider supporting or related state included within the statemachine. The game this induces on the code is very simple. First, you associate code to a state machine label:
Finally, the state transitions can happen over time via the in keyword on the transition keyword.