But all were sinners. The Bible doesn't attempt to portray David as "good" (vs. "bad"). Instead, it presents David as a man who was whole-hearted (even if not whole-actioned) toward God -- and that especially included David's prayer-and-worship life; and was a man who meshed with God's purposes.
And yes, Jesus says it's not the outside of you that makes you unclean, but what comes out of our hearts.
Men are oft' abnormally overabsorbed with the externals. God looks at us from the inside-out. Are we, as Jesus accused the legalists of being, whitewashed tombstones? (Dead on the inside; bright & white on the outside) Or, are we lukewarm where our external deeds don't match the presence of the Holy Spirit on the inside?
Yes, but the point was that David’s sin was having sex with the wife of another man was the sin specifically, and not his other marriages, that he concurrently had.
Men are oft’ abnormally overabsorbed with the externals. God looks at us from the inside-out. Are we, as Jesus accused the legalists of being, whitewashed tombstones? (Dead on the inside; bright & white on the outside) Or, are we lukewarm where our external deeds don’t match the presence of the Holy Spirit on the inside?
If we read what Nathan said to David, it all started on the inside, in David’s heart, by lusting after Bathsheba, then exacerbating the circumstances until he became a murderer. I really don’t see where you try to argue on the faith and works part. Yes, in that sense, Jesus would emphasize the importance of what’s inside because it’s a matter here about cause and effect. The cause was the fact that a person allowed him or herself to be too preoccupied with the wrong thing up to the point of doing it.
Of course we need repentance, and therefore divine grace because we aren’t perfectly without sin, but it doesn’t mean that I have to wait till my deathbed to make the confessions. Hey making confessions to the clergy is a good thing, and they can talk and counsel with you about working to overcome some of the problems that might be facing you.