Added arbitrary dimension mask feature.