Updated Js code