make profile package.unmask support similar to package.mask support
use defaultdict to simplify code
simplify masking/unmasking set creation and use better variable names