However, the phalanx did not totally disappear. The phalanx might not have been obsolete at the end of its history. In some battles between the Roman army and Hellenistic phalanxes, such as Pydna (168 BC), Cynoscephalae (197 BC) and Magnesia (190 BC), the phalanx performed well. It even drove back the Roman infantry. However, at Cynoscephalae and Magnesia, failure to defend the flanks of the phalanx led to defeat. At Pydna, the phalanx lost cohesion when pursuing retreating Roman soldiers. This allowed the Romans to penetrate the formation. Then, Roman close combat skills proved decisive. The historian Polybius details the effectiveness of the Roman legion against the phalanx. He deduces that the Romans refused to fight the phalanx where the phalanx was effective, Romans offered battle only when a legion could exploit the clumsiness and immobility of a phalanx.