added mask support, etc