some refactoring for requirejs