Added edgeMask function