Add connection logic