adding disconnect logic