added connection function.