fixed controller.js to be faster