CTW update in 'revert'.

Refactored CTW update code to avoid duplication in update
and revert.