Changed cMatrix generation according to new format