The best method of correcting a vice is by exercising the opposite virtue:
Avarice is cured by liberality.
Pride by humility and obedience.
Gluttony by fasting.
And so with every evil habit and inclination of the human heart.