Added logging and cleaned up the demo app.