Made 'app' a global for console testing.