Refactors index to use session module.