Moved more javascript out of the html