First round of mask refactor.
Merge pull request #8 from akleroy/mask-object

First round of mask refactor.