separating the javascript