modified function in controller