modularized router code