Minor cleanups related to undo and redo