implement state machine grain