pushed remove duplicate links into a function