Updated to make debugging a little easier and obey and connect/disconnect wishes of the user.