corrected cmc.R script