Refactored linking step, tests are passing