Fix out of sync live widget and actual app setting. 

Refactor appState. Introduce config.js