State Machine 2.0

Simplification of the state machine