more javascript optimization