Added simple dynamic state machine
Add appState