moved checking element mask to separate function in MM engine