Update index.html

Some bug fixes and code cleaning.