Updated JS functions