added smart connection mechanism