After the Lord rejected Saul as king, he chose a man with a heart oriented toward the Lord.
The tenth plague was the death of the firstborn of Egypt, which was also the salvation of the people of Israel.
No matter how bad things get, God is still working out his own holy will through seen and unseen agents.