refactor to allow plug in didFinishLaunchingWithOptions