restructure HTML and JS for explictness