Homer becomes depressed when he sees that Ned Flanders seems to be better off than him. To remedy this, he begins to pray constantly. Meanwhile, the Simpsons discover that tree roots have clogged up their plumbing. The house becomes too run down to live in, and Homer prays for a solution. Homer is injured while attending church; he sues Reverend Lovejoy and is awarded the deed to the church. He throws a huge house-warming party, in which all of the partiers drink and engage in sinful activities. It suddenly starts raining and the town begins to flood. The townspeople flee to the roof of the church. Homer tries praying again but the flood keeps rising. Reverend Lovejoy returns in a helicopter and leads everyone in prayer, asking God to forgive them, and the rain stops.