Merge pull request #159 from Animatron/trying-optimisations

Mask fixes
Merge branch 'master' into trying-optimisations