added master mask and background mask