Move logic for the route matching