started refactoring app state to getAppState()