Optimized router code.