Added masking support
Fixed masking registration issues