In that same year Beresford was sent to Madeira, which he occupied in name of the King of Portugal, remaining there for six months as Governor and Commander in Chief. The exiled Portuguese Government in Rio de Janeiro, Brazil, whereto the Portuguese Royal Family had set up a Court in exile, realised the necessity of appointing a commander-in-chief capable of training, equipping and disciplining the demoralised Portuguese Royal Army. The Portuguese government asked Britain to appoint Arthur Wellesley to this role, Wellesley indicated he could not do the role justice due to his prior engagements and recommended Beresford. He was appointed Marshal and Commander in Chief of the Army by Decree of 7 March 1809 and took the command on 15th of the same month. At that time, French general Marshal Soult had already crossed into Portugal where he occupied Porto. Beresford quickly overhauled the Portuguese forces, bringing them in line with British discipline and organization, and from the General Headquarters (then at the "Largo do Calhariz"), he dispatched many "daily orders" altering points of the infantry ordnance, creating a general command of artillery, establishing the separation of the battalions, firing incompetent or corrupt officers and promoting or appointing appropriate replacements.