new version with undo/redo