Working undo and redo from the menu