Added some minor re-factoring to keep the cast-appID separate from appName.