update to be AMD with Require.js compatible