Added mask validation