change the way connections are tracked and clean up