JS code corrected