Programatic use of undo/redo