Remove g_app global variable. Context interface improvements.