refactoring to use requirejs