tor complete & refactoring