refactored session usage