move all js code to separate file.