assign router & reformat code