Add private method and refactor controller.