Implemented Mask evaluation. Best masking pattern is now automatically
selected.