move namespace handling out of mainapp.js into its own manager.js