Add listener for undo and redo