Perhaps this could be moved to the controller.