cwc: code cleanups and improvements for ECM handling