refactor to use commonjs syntax for requirejs