created connect function