We often have a little mental image of Satan in our heads, where he sits on our shoulder, tempting us to sin. While Satan does tempt us to sin, that is not the majority of his effort.
Satan, is above all, the Father of Lies. It is lies that he loves and cherishes, and that he tries to insinuate into our lives. It makes our sins all the more delicious for him, for if we act according to a wrong idea, then it was just us choosing between right and wrong. If he can get us to believe a falsehood, then he all all the less work to do, getting us to sin on our own. The "Devil made me do it" is less often even an influence than we think.
Thus, we need to realize the importance of ideas, particularly those that we accept and incorporate as part of ourselves. It is in the realm of ideas and doctrines, that the Devil spends most of his time, and not commandments and rules. If he can win with ideas and doctrines of devils, then rules of any kind will have a very hard time keeping us in the right way. Thus we see the importance of ideas. People often try to change things with commandments and rules, but the greatest power, and danger, is in ideas. Hence the verse
But ye are commanded in all things to ask of God, who giveth liberally; and that which the Spirit testifies unto you even so I would that ye should do in all holiness of heart, walking uprightly before me, considering the end of your salvation, doing all things with prayer and thanksgiving, that ye may not be seduced by evil spirits, or doctrines of devils, or the commandments of men; for some are of men, and others of devils. D&C 46: 7
It is ideas and doctrines that drive us and compel us. Thus, even more than the commandments, we must be certain we understand correct doctrine and true principles, or we may give undue weight to what seems to us, to be of the utmost importance. God loves us more than even we love ourselves, but He understand more perfectly what it is that will make us happy. And those things are often different from what the world teaches.
This is the source of a lot of the struggle is chastity - wrong ideas that seem so close to the truth as to seem indistinguishable. If we could understand things correctly, we would plainly see and agree to the importance of chastity.