cw refactoring