Added a check for the root controller method in the router to prevent an infinite loop