Refactoring to make usage of multiple session handling