Add undo/redo functionality