Completed the main controller.