Added some fucntions to implements masks