revising the undo/redo functionality