resource and router refactor.