refactor with requirejs