Overlay tests added. Removed a function from main.js and added it to global.js for the sake of tests.