10. some optimizations to speed the tree up