Minor refactoring and added session clear on return to homepage