move the cruft out of the JavaScript file