Tweaked code in controller.