Trying to refactor linking functions