Converted from browser globals to require.js