CTW: code for revert and a slight fix to update.