Adding functions to controller.