Cleaned up remaining bits from old disconnect callback. Added automatic connection management. Fixed possibility of unintended throws of bad_weak_ptr.