added "is connected" checks where needed