iImplemented state machine

Added some events to configuration to support it.

This is broken, but I wanted to checkpoint here.
Spawn cmd server