Added MASK and WHICH, with tests.

Used to be part of CLNU.