cleaned up dependencies
improced connect/disconnect/reconnect handlind