refactor Tree