Added app state tracking