adding runonce option to mask function