Fix index page by factoring