Added factory to create mask instances