Refactored js to handle differently modern and legacy browsers.