Moved logic to background pages