Committed to the State machine

State machine is starting to take shape. There muse be a better way.