still hackish way to infer app entry point, but at least without globals.