Commented replacelinks function