refactor requirejs integration