Refactor to work with real sessions