Almost fixed connecting algorithm...