Refactor for the part that combines the final links together