added disconnect function