Fully implemented AppDelegate