tree renderer refactored