Refactoring to tidy up index page