Why was the catholic church so powerful in the middle ages