AppDelegate refactor