refactors index page