refactoring to use requireJS