more refactoring for requirejs