UPDATED main controller.