Add disconnection logic.