Codes for "mc" R package