Save application state in a global variable. Good idea?