Better thread management, connection recovery