Updated js functionality