Refactor link substitutions