refactor session