format copy, add more javascript functions