The Turnbull government has successfully passed the legislation to re-establish the ABCC construction watchdog, marking a key victory for Malcolm Turnbull who used the legislation to trigger this year's double dissolution election.
The government secured the crossbench votes it needed after frenzied deal-making and horse-trading in the final parliamentary sitting week of 2016.
The victory was locked in after a handshake deal with crossbench senator Derryn Hinch, who was concerned about retrospectivity, and gifts for the the Nick Xenophon Team, including concessions on the Murray-Darling Basin Plan and an overhaul of government procurement policy to favour Australian businesses.
Senator Hinch, who has been thrust into the spotlight over the negotiations, has had a whack at his fellow crossbenchers, accusing them of "disgusting" and "opportunistic and self-serving" horse-trading over the bill.
The Victorian said he had not engaged in any deal-making that was unrelated to the merits of the bill and that he was under "probably more pressure than I've ever felt in my life".
"I'll tell you one thing. I wish, in one way, I wish the government had a five-seat majority in the Senate and I wouldn't have to be the man in the middle. Because I'm pretty new to this," he told ABC radio.
Having lobbied for several amendments, Senator Hinch said Prime Minister Malcolm Turnbull had agreed to remove any "retrospectivity" from the new building code, allowing existing enterprise bargaining agreements to remain in place for two years.
"The Prime Minister has agreed with me – we shook hands on it," he told ABC radio, saying he was about to visit Mr Turnbull again immediately following the interview.
The government has been courting the votes of One Nation's four senators (including the unpredictable Rodney Culleton), the three NXT senators, Senator Hinch and Liberal Democrat senator David Leyonhjelm to get the bill passed.
They needed eight of the 10 crossbench votes to pass the bill. Family First senator Bob Day, a strong supporter of the legislation, quit the Senate at the start of November.
Employment Minister Michaelia Cash had previously insisted the new code would apply to all EBAs created since April 2014, when the legislation was first drafted. This position has triggered industrial action.
Favouring local businesses in the $60 billion of spending on government projects - part of its agreement with Senator Xenophon - also represents a reversal of the Coalition's previous position and will force bidders to show much of their product is Australian made and that they are employing locals.
Following the resolution of the stand-off over the Murray-Darling, Senator Xenophon said: "I almost feel like the minister without the pay rise".