Final JavaScript for HTML