Remove obsolete code
Rename mask variable
Swap fg and bg