Better session handling

Improve session creation and management
Handle session errors
Handle disconnects better