changed CloneTree() to use unique_ptr