refactors and session