moved the routing creation logic away from the controller