When King Frederick II was crowned in 1559, he immediately began expanding the navy. The number of bases, yards and vessels rose rapidly and substantial resources were used for new ship designs, weaponry, training and battle tactics. Sweden, which had become an independent country, dominated a large part of the Baltic Sea and threatened Danish merchant interests. In retaliation, Denmark closed the Øresund in 1568, laying the first seeds for the Scanian War , only eight years after the end of the second Nordic War , during which Denmark lost the now Swedish provinces of Skåne, Halland and Blekinge. During this period, further resources were allocated to the navy. Cort Adeler and Niels Juel led the Danish navy to a victory in the Battle of Køge Bay in 1677. King Christian IV  continued in his father's footsteps. In the beginning of the 17th century, he considerably expanded the naval workships. In Copenhagen, where the navy resided, he built a large number of homes for crewmembers and workshop craftsmen — the most famous being Nyboder  which still stands in central Copenhagen. General admiral lieutenant Ulrik Christian Gyldenløve was appointed supreme commander of the navy in 1701. He raised the status of the naval profession and established Søkadetakademie, the predecessor of the Royal Danish Naval Academy. In 1709, Peter Jansen Wessel joined the navy. He was later given the rank of admiral as a reward for his many victories - most famously at Marstrand and Dynekilden. He was later known as Tordenskjold.. Who was king last: Frederick II or Christian IV?