refactor storage of session