Safeguards for Purity
It is one of the penalties of Original sin that the struggle against impurity continues throughout life and demands a constant custody of the senses, of the thoughts, desires and speech. Modesty in dress, reserve in actions, and careful choice of entertainment are necessary safeguards for preserving purity in ourselves and others. The spirit of penance and self-denial, frequent recourse to the Sacraments, docility to the Holy Spirit and prayer, are all most necessary means to be employed as weapons in this battle. We cannot play with fire and not be burned; we cannot expose ourselves to impurity and not sin. With humility and self-distrust we must "fly" from the occasions of sin, for as Holy Scripture tells us, "He that loveth danger shall perish in it." (Ecclus. 3:27).
Bad thoughts, however filthy and abominable, are not sins. It is only by consenting to them that we commit sin. We shall never be overcome so long as we call on the holy Names of Jesus and Mary. During the assaults of temptation, it is most useful to renew our resolution of suffering death rather than offend God; it is also a good practice to sign ourselves repeatedly with the Sign of the Cross, and with holy water. It is of great help, too, to reveal the temptation to our confessor. But prayer is the best remedy of all, accompanied by cries for help to Jesus and Mary.