rewrite with require.js style