Why was the church so powerful in the middle ages