Reworked to remove synchronous XHR from content script for better performance.