Tweaks to the JS code