drafted connect function (untested)