Testability changes

Various changes to make it easier to test by others. Also demonstrates how to determine and set the app ID so it doesn't need to be hard-coded.