Small refactoring of session.cc