Updated js snippet