add function to controller