What's with the chrome & chrome.socket  check? None of this code will work without it defined. Maybe remove?