Rework of connection handling