Remove duplicated code, linksInSelection is set later again