Tempates for state machine