Refactor wikilinks into a few smaller functions