fix issue with sessions
tidy formatting