Added logic to enable/disable undo/redo menu items.