Separating out functions from the controller.