diff --git a/wikibot.py b/wikibot.py
index 9f6f9eec253a4835867ce9b4f33f2e1d782a2e53..6a38d6732f14f121fa41a9347466a383aeeb998f 100644
--- a/wikibot.py
+++ b/wikibot.py
@@ -12,13 +12,7 @@ def move_page(original_page, new_page, delete=False):
 		proxy.wiki.putPage(new_page, page_content, {"sum":"Moved from " + original_page})
 
 		# update back links to new page #
-		back_links = proxy.wiki.getBackLinks(original_page)
-		reg = rf"\[\[\s*{original_page}\s*\|(.*?)\]\]" # regex for dokuwiki links we want to replace
-		_replacer = lambda matched : "[[" + new_page + "|" + matched.group(1) + "]]"
-		for page in back_links:
-			content = proxy.wiki.getPage(page)
-			content = re.sub(reg, _replacer, content)
-			proxy.wiki.putPage(page, content, {"sum":"Update links from " +original_page+ " to " + new_page})
+		change_links(original_page, new_page)
 
 		# either flag or delete original page #
 		if not delete:
@@ -28,6 +22,18 @@ def move_page(original_page, new_page, delete=False):
 			proxy.wiki.putPage(original_page, "", {"sum":"Moved to " + new_page}) # deletes original page
 
 
+def change_links(old_page, new_page):
+	"""Updates pages that link to old page, to link to new page"""
+	with Proxy(config.WIKI_API_URL) as proxy:
+		backLinks = proxy.wiki.getBackLinks(old_page)
+		reg = rf"\[\[\s*{old_page}\s*\|(.*?)\]\]" # regex for dokuwiki links we want to replace
+		_replacer = lambda matched : "[[" + new_page + "|" + matched.group(1) + "]]"
+		for page in backLinks:
+			content = proxy.wiki.getPage(page)
+			content = re.sub(reg, _replacer, content)
+			proxy.wiki.putPage(page, content, {"sum":"Update links from " +old_page+ " to " + new_page})
+
+
 def find_old_pages(timedelta, namespace=""):
 	"""Returns all pages whose rev is older than the given timedelta"""
 	with Proxy(config.WIKI_API_URL) as proxy: