Should this just be `assert(root);`? I think it's an error to invoke this with a NULL root object.