main.js updated to support new app object model