added mask support