optimized connection handling