Improving connection handling