setting up state machine mechanic