refactored session logic to use session.equals