modified for links thresholding