basic connection logic