handle sessions in code much better which fixes #8