reparallelize mask generation