Moved a bunch of session-specific code into session.rb from session_manager.rb