added connect logic