Adding undo tree