refactor to use requirejs