refactored globals into appinit.js