Improved Background.js