refactoring add link code