js code moving from .html to .js
js call simplification