Improve link anchor detection and removal