improve index page code