Better handling of connections