added connection code