Add the undo and redo methods.