(The function can be optimized such that the black mask is not visible to the end user)