refactor session class a bit