cwc: improvements for ECM handling and code cleanups