Refactor routing into dependent components