connection algorithm implemented