As a result of the change in its status and the arrival of the Portuguese royal family, Brazilian administrative, civic, economical, military, educational, and scientific apparatus were expanded and highly modernized. Until when did the King of Portugal remain in Brazil?