Refactor app to single global var TerminalApp