refactored session.