added connect middleware