wire connection logic