Added disconnection handling.