moved js file out of html file and separated concerns