add router;rafactor code