Updated js code