refactor to use requirejs to apply AMD pattern