Updated implementation to work with chrome.