stop hard-coding output file names
moved JavaScript to external file