Factor out controller.