Route sorting rewrite