Undo/redo now works properly