Refactor running the linker into a separate function