Better connection handling