finished html and js functionality