optimized session handling. closes #41