Update index.html

Code review
- Put not reusable code in calling code