First the pattern then the mask

Yay emacs :)
Oops left half of that commit behind because saving is hard