Added disconnect support (may be buggy).