modified function-controller.js