do some refacting for index.html