Pulled out most of the code in the controller into a default controller.