Optimize routing precedence (Issue #313)