refactoring outsourcing the sessions_manager