extract the javascript into a separate js file