Fixing bitmasking values

I'm not sure but your bit masking usage was strange.
I tried a little refactoring to clarified the tested options.