Add function to controller.