For those that don't know the Old Testament/Torah it might be worthwhile to point out that what you refer to as "moral failings" is not the same as what modern people think are "moral failings". Uncleanliness (gay sex, touching menstruating women, eating pork, yadda, yadda) and worshiping other Gods are "moral failings", raping, pillaging, and exterminating enemies most definitely are not.