figured out and reformatted the javascript