What was the role of religion in everyday life during the middle ages