Moved route logic to a controller.