Rebuilt state machine, implemented pausing, separated exit state