small optimizations to treeview