some js snippet modified