minor js snippet modifications