Added some functions in controllers.js