add undo/redo functionality