Refactoring session handling
Merge pull request #16 from wagnert/master

Refactoring session handling