Severely cleaned up the cable connection code.