refactor sessions