Mega commit from Olga

Was implemented general framework for CW.