improved structures and sockets management