reformat some javascript