Added basic undo/redo support.