Adding automatic mask selection.