Added function to controller