Changed Shape masking logic