Could updateSelectedInTree use visitTreeLeaves internally?