copied code from controller.js and controller.html