Decoder now takes optional mask