The settlements at Tilsit gave Napoleon time to organize his empire. One of his major objectives became enforcing the Continental System against the British. He decided to focus his attention on the Kingdom of Portugal, which consistently violated his trade prohibitions. After defeat in the War of the Oranges in 1801, Portugal adopted a double-sided policy. At first, John VI agreed to close his ports to British trade. The situation changed dramatically after the Franco-Spanish defeat at Trafalgar; John grew bolder and officially resumed diplomatic and trade relations with Britain.