Scalar-tensor theories of gravity play an essential role for building models of inflation and dark energy. A particularly interesting class of models involves higher derivatives in the Lagrangian and, for a long time, the Ostrogradsky’s theorem shaped these models in order to give second order field equations. \par In this talk I will show a novel way to avoid ghost instabilities usually associated to higher order scalar-tensor theories, and present brand new classes that can be obtained.