Implemented clean disconnect