moved all the javascript to file