first version working, global mask