Rewrites all routing functionality