Refactored functions in support of both Tree and Set views.