Background script was added; Parts of code were moved from main.js to background.js