How did the peace of westphalia lay the foundations?