Surgery

A man presented with fractures of 4th to 10th ribs and respiratory distress after a Road Traffic Accident (RTA). He is diagnosed to have flail chest and a PaO2 of <60%. Management is -