R7: Add undo, redo and recording functions.