updated router code