modified to call removeDiffListener on exit.