David kept the ways of Yahweh by keeping Yahweh's statutes instead of acting wickedly and turning from God. [22:22-23]