refactor router using routes