Add DemoState and refactor state transitions