Do no wickdness and serve with pure heart is better than fasting.Fasting is good, but doesn´t help if the person don´t keep the commandments of the Lord.
If keeping the commandments he adds the fasting, so great, but otherwise the fast is not going to fix the lack of obedience.
Hermas was fasting and sit in a mountain, but his fasting was said to be unprofitable by the angel.
Hermas explained he fasted as acustomed and that he was "keeping a station", but the angel said he would tell he what kind of fast pleases the Lord.
"4. God desireth not such vain fasting; for by fasting thus unto God thou shalt
do nothing for righteousness. But fast thou such a fast as this unto God.
5. Do no wickedness in thy life, and serve the Lord with a pure heart.
Keep His precepts and walk in His ordinances, and let no evil lust arise
in thy heart; but believe in God.
If thou do these things and fear Him, and contain thyself from every evil deed,
thou shalt live unto God; and these things if thou do,
thou shalt accomplish a great fast and one acceptable to God." (Shepherd of Hermas 5th Sim. 1.4,5)
"5. This fasting, quoth he, when the commandments of the Lord are observed,
is exceeding good. Thus then shalt thou keep this fast which thou art about
6. First of all keep thyself from every evil word and every evil desire,
and cleanse thy heart from all the vanities of this world.
If thou keep these things, this shall be a perfect fast for thee." (Shepherd of Hermas 5th Sim. 3.5,6)
"8. If thou thus accomplish the fast as I have enjoined thee,
thy sacrifice shall be accepted of God, and this fast shall be registered;
for the service so performed is good and agreeable and acceptable unto the Lord." (Shepherd of Hermas 5th Sim. 3.8)
Keep your body also clean and pure."Attend now, quoth he; keep this thy flesh pure and undefiled,
that the Spirit which dwelleth in it may bear witness to it,
and thy flesh maybe justified.
2. Beware lest the thought arise in thy heart that this thy flesh is to perish,
and thou abuse it with any pollution.
If thou pollute thy flesh thou shalt pollute the Holy Spirit also;
the which if thou pollute thou shalt not live." (Shepherd of Hermas 5th Sim. 7.1,2)
"16 yet knowing that a man is not justified by the works of the law but through faith in Jesus Christ, even we believed on Christ Jesus, that we might be justified by faith in Christ, and not by the works of the law: because by the works of the law shall no flesh be justified." (Gal. 2:16)