Add masking and LID insertion