Improved and tidied up the default app example code.