Refactored Session as suggested in #1172