Added MS file to mask function