added degrade_mask function!