Added sorting of routes to get correct matching of routes