fixed up tree builder with generic type
merge