Converting more javascript to jquery.